|
1 | 1 | # Instrumentation options
|
2 | 2 |
|
3 |
| -When you call the instrumentation, you can give an optional configuration object: |
| 3 | +When you call the instrumentation, you can give an optional configuration object. As stated, each property in the object provided is optional. |
4 | 4 |
|
5 |
| -## maxAge |
| 5 | +## Configuration Object Properties |
6 | 6 |
|
7 |
| -number (>1) | false - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance. Default is `false` (infinite). |
| 7 | +### `maxAge` |
8 | 8 |
|
9 |
| -## logOnly |
| 9 | +number (>1) | `false` - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance. Default is `false` (infinite). |
| 10 | + |
| 11 | +### `logOnly` |
10 | 12 |
|
11 | 13 | boolean - connect to the Devtools Extension in log-only mode. Default is `false` which enables all extension [features](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#features).
|
12 | 14 |
|
13 |
| -## name |
| 15 | +### `name` |
14 | 16 |
|
15 |
| -string - the instance name to be showed on the monitor page. Default value is _NgRx Store DevTools_. |
| 17 | +string - the instance name to show on the monitor page. Default value is NgRx Store DevTools. |
16 | 18 |
|
17 |
| -## monitor |
| 19 | +### `monitor` |
18 | 20 |
|
19 | 21 | function - the monitor function configuration that you want to hook.
|
20 | 22 |
|
21 |
| -## actionSanitizer |
| 23 | +### `actionSanitizer` |
| 24 | + |
| 25 | +function - takes `action` object and id number as arguments, and should return an `action` object. |
| 26 | + |
| 27 | +### `stateSanitizer` |
| 28 | + |
| 29 | +function - takes `state` object and index as arguments, and should return a `state` object. |
| 30 | + |
| 31 | +### `serialize` |
| 32 | + |
| 33 | +- options |
| 34 | + - `undefined` - will use regular `JSON.stringify` to send data |
| 35 | + - `false` - will handle also circular references |
| 36 | + - `true` - will handle also date, regex, undefined, primitives, error objects, symbols, maps, sets and functions |
| 37 | + - object - which contains `date`, `regex`, `undefined`, `NaN`, `infinity`, `Error`, `Symbol`, `Map`, `Set` and `function` keys. For each of them, you can indicate if they have to be included by setting them to `true`. For function keys, you can also specify a custom function which handles serialization. |
| 38 | + |
| 39 | +For more detailed information see [Redux DevTools Serialize](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#serialize) |
| 40 | + |
| 41 | +### `actionsBlacklist` / `actionsWhitelist` |
| 42 | + |
| 43 | +array of strings as regex - actions types to be hidden / shown in the monitors, [more information here](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#actionsblacklist--actionswhitelist). |
| 44 | + |
| 45 | +### `predicate` |
| 46 | + |
| 47 | +function - called for every action before sending, takes state and action object, and returns `true` in case it allows sending the current data to the monitor, [more information here](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#predicate). |
22 | 48 |
|
23 |
| -function - takes `action` object and id number as arguments, and should return `action` object back. |
| 49 | +### `features` |
24 | 50 |
|
25 |
| -## stateSanitizer |
| 51 | +configuration object - containing properties for features than can be enabled or disabled in the browser extension Redux DevTools. These options are passed through to the browser extension verbatim. By default, all features are enabled. For more information visit the [Redux DevTools Docs](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#features) |
26 | 52 |
|
27 |
| -function = takes `state` object and index as arguments, and should return `state` object back. |
| 53 | +```typescript |
| 54 | +features: { |
| 55 | + pause: true, // start/pause recording of dispatched actions |
| 56 | + lock: true, // lock/unlock dispatching actions and side effects |
| 57 | + persist: true, // persist states on page reloading |
| 58 | + export: true, // export history of actions in a file |
| 59 | + import: 'custom', // import history of actions from a file |
| 60 | + jump: true, // jump back and forth (time travelling) |
| 61 | + skip: true, // skip (cancel) actions |
| 62 | + reorder: true, // drag and drop actions in the history list |
| 63 | + dispatch: true, // dispatch custom actions or action creators |
| 64 | + test: true // generate tests for the selected actions |
| 65 | +}, |
| 66 | +``` |
28 | 67 |
|
29 |
| -## serialize |
| 68 | +## Example Object as provided in module imports |
30 | 69 |
|
31 |
| -false | configuration object - Handle the way you want to serialize your state, [more information here](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#serialize). |
| 70 | +<code-example header="app.module.ts"> |
| 71 | +@NgModule({ |
| 72 | + ... |
| 73 | + imports: [ |
| 74 | + ... |
| 75 | + StoreDevtoolsModule.instrument({ |
| 76 | + maxAge: 25, |
| 77 | + logOnly: false, |
| 78 | + features: { |
| 79 | + pause: false, |
| 80 | + lock: true, |
| 81 | + persist: true |
| 82 | + } |
| 83 | + }) |
| 84 | + ], |
| 85 | + ... |
| 86 | +}) |
| 87 | +</code-example> |
0 commit comments