Skip to content

Commit

Permalink
Describe getMonitor api
Browse files Browse the repository at this point in the history
Related to #140 & #145.
  • Loading branch information
zalmoxisus committed Jul 15, 2016
1 parent 352f079 commit a87a6ee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/API/Arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@
statesFilter: (state) => state.data ? { ...state, data: '<<LONG_BLOB>>' } : state)
}));
```
- **getMonitor** (*function*) - return monitor object with the following properties:
- **start** (*function*) - starts monitoring (relaying logs to the monitor).
- **stop** (*function*) - stop monitoring (the monitor will not get new changes till you `start` it again with the function above).
- **update** (*function*) - update state history. Usually you want to use it when stopped monitoring (with the function above) and want to update the logs explicitly (useful for apps which dispatch actions too frequently).
- **isHotReloaded** (*function*) - return `true` if reducers just got hot reloaded (useful for dealing with side effects, which didn't get hot-reloaded).
- **isMonitorAction** (*function*) - return `true` if the last action was dispatched by the monitor (was: 'TOGGLE_ACTION', 'SWEEP', 'SET_ACTIONS_ACTIVE', 'IMPORT_STATE').
- **isTimeTraveling** (*function*) - return `true` if the state was set by moving back and forth (the last action was dispatched by the monitor was 'JUMP_TO_STATE'). Usually you want to use it to skip side effects.
Example of usage:

```js
export let isMonitorAction;
export default function configureStore(initialState) {
return createStore(reducer, initialState,
window.devToolsExtension && window.devToolsExtension({
getMonitor: (monitor) => { isMonitorAction = monitor.isMonitorAction; }
}) : f => f
);
}
```
Then import it, for example, like [here](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/examples/counter/components/Counter.js).
### `window.devToolsExtension(reducer, [preloadedState, config])`
> Note: This is not intended to replace Redux' `createStore`. Use this approach only when you want to inspect changes outside of Redux or when not using Redux inside your application.
Expand Down

0 comments on commit a87a6ee

Please sign in to comment.