diff --git a/README.md b/README.md index cf09687..43156b1 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,8 @@ Name | Description `secure` | *Boolean* specifies whether to use `https` protocol for [`remotedev-server`](https://github.com/zalmoxisus/remotedev-server). `maxAge` | *Number* of maximum allowed actions to be stored on the history tree, the oldest actions are removed once maxAge is reached. Default is `30`. `filters` | *Map of arrays* named `whitelist` or `blacklist` to filter action types. See the example bellow. -`actionsFilter` | *Function* which takes action object and id number as arguments, and should return action object back. See the example bellow. -`statesFilter` | *Function* which takes state object and index as arguments, and should return state object back. See the example bellow. +`actionSanitizer` | *Function* which takes action object and id number as arguments, and should return action object back. See the example bellow. +`stateSanitizer` | *Function* which takes state object and index as arguments, and should return state object back. See the example bellow. `startOn` | *String* or *Array of strings* indicating an action or a list of actions, which should start remote monitoring (when `realtime` is `false`). `stopOn` | *String* or *Array of strings* indicating an action or a list of actions, which should stop remote monitoring. `sendOn` | *String* or *Array of strings* indicating an action or a list of actions, which should trigger sending the history to the monitor (without starting it). *Note*: when using it, add a `fetch` polyfill if needed. @@ -107,11 +107,11 @@ export default function configureStore(initialState) { name: 'Android app', realtime: true, hostname: 'localhost', port: 8000, maxAge: 30, filters: { blacklist: ['EFFECT_RESOLVED'] }, - actionsFilter: (action) => ( + actionSanitizer: (action) => ( action.type === 'FILE_DOWNLOAD_SUCCESS' && action.data ? { ...action, data: '<>' } : action ), - statesFilter: (state) => state.data ? { ...state, data: '<>' } : state + stateSanitizer: (state) => state.data ? { ...state, data: '<>' } : state }) ); // If you have other enhancers & middlewares diff --git a/src/devTools.js b/src/devTools.js index 645b6f0..d113d33 100644 --- a/src/devTools.js +++ b/src/devTools.js @@ -30,8 +30,8 @@ let sendOnError; let sendTo; let lastErrorMsg; let actionCreators; -let statesFilter; -let actionsFilter; +let stateSanitizer; +let actionSanitizer; function getLiftedState() { return filterStagedActions(store.liftedStore.getState(), filters); @@ -68,11 +68,11 @@ function relay(type, state, action, nextActionId) { }; if (state) { message.payload = type === 'ERROR' ? state : - stringify(filterState(state, type, filters, statesFilter, actionsFilter, nextActionId)); + stringify(filterState(state, type, filters, stateSanitizer, actionSanitizer, nextActionId)); } if (type === 'ACTION') { message.action = stringify( - !actionsFilter ? action : actionsFilter(action.action, nextActionId - 1) + !actionSanitizer ? action : actionSanitizer(action.action, nextActionId - 1) ); message.isExcess = isExcess; message.nextActionId = nextActionId; @@ -190,8 +190,8 @@ function init(options) { if (sendOnError === 1) catchErrors(); if (options.actionCreators) actionCreators = () => getActionsArray(options.actionCreators); - statesFilter = options.statesFilter; - actionsFilter = options.actionsFilter; + stateSanitizer = options.stateSanitizer; + actionSanitizer = options.actionSanitizer; } function start() {