1 | import { Action, ActionCreator, StoreEnhancer, compose } from 'redux';
|
2 |
|
3 | export interface EnhancerOptions {
|
4 | /**
|
5 | * the instance name to be showed on the monitor page. Default value is `document.title`.
|
6 | * If not specified and there's no document title, it will consist of `tabId` and `instanceId`.
|
7 | */
|
8 | name?: string;
|
9 | /**
|
10 | * action creators functions to be available in the Dispatcher.
|
11 | */
|
12 | actionCreators?: ActionCreator<any>[] | { [key: string]: ActionCreator<any> };
|
13 | /**
|
14 | * if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once.
|
15 | * It is the joint between performance and speed. When set to `0`, all actions will be sent instantly.
|
16 | * Set it to a higher value when experiencing perf issues (also `maxAge` to a lower value).
|
17 | *
|
18 | * @default 500 ms.
|
19 | */
|
20 | latency?: number;
|
21 | /**
|
22 | * (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance.
|
23 | *
|
24 | * @default 50
|
25 | */
|
26 | maxAge?: number;
|
27 | /**
|
28 | * - `undefined` - will use regular `JSON.stringify` to send data (it's the fast mode).
|
29 | * - `false` - will handle also circular references.
|
30 | * - `true` - will handle also date, regex, undefined, error objects, symbols, maps, sets and functions.
|
31 | * - object, which contains `date`, `regex`, `undefined`, `error`, `symbol`, `map`, `set` and `function` keys.
|
32 | * For each of them you can indicate if to include (by setting as `true`).
|
33 | * For `function` key you can also specify a custom function which handles serialization.
|
34 | * See [`jsan`](https://github.com/kolodny/jsan) for more details.
|
35 | */
|
36 | serialize?:
|
37 | | boolean
|
38 | | {
|
39 | date?: boolean;
|
40 | regex?: boolean;
|
41 | undefined?: boolean;
|
42 | error?: boolean;
|
43 | symbol?: boolean;
|
44 | map?: boolean;
|
45 | set?: boolean;
|
46 | function?: boolean | Function;
|
47 | };
|
48 | /**
|
49 | * function which takes `action` object and id number as arguments, and should return `action` object back.
|
50 | */
|
51 | actionSanitizer?: <A extends Action>(action: A, id: number) => A;
|
52 | /**
|
53 | * function which takes `state` object and index as arguments, and should return `state` object back.
|
54 | */
|
55 | stateSanitizer?: <S>(state: S, index: number) => S;
|
56 | /**
|
57 | * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
58 | * If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
|
59 | */
|
60 | actionsBlacklist?: string | string[];
|
61 | /**
|
62 | * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
63 | * If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
|
64 | */
|
65 | actionsWhitelist?: string | string[];
|
66 | /**
|
67 | * 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.
|
68 | * Use it as a more advanced version of `actionsBlacklist`/`actionsWhitelist` parameters.
|
69 | */
|
70 | predicate?: <S, A extends Action>(state: S, action: A) => boolean;
|
71 | /**
|
72 | * if specified as `false`, it will not record the changes till clicking on `Start recording` button.
|
73 | * Available only for Redux enhancer, for others use `autoPause`.
|
74 | *
|
75 | * @default true
|
76 | */
|
77 | shouldRecordChanges?: boolean;
|
78 | /**
|
79 | * if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type.
|
80 | * If not specified, will commit when paused. Available only for Redux enhancer.
|
81 | *
|
82 | * @default "@@PAUSED""
|
83 | */
|
84 | pauseActionType?: string;
|
85 | /**
|
86 | * auto pauses when the extension’s window is not opened, and so has zero impact on your app when not in use.
|
87 | * Not available for Redux enhancer (as it already does it but storing the data to be sent).
|
88 | *
|
89 | * @default false
|
90 | */
|
91 | autoPause?: boolean;
|
92 | /**
|
93 | * if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button.
|
94 | * Available only for Redux enhancer.
|
95 | *
|
96 | * @default false
|
97 | */
|
98 | shouldStartLocked?: boolean;
|
99 | /**
|
100 | * if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer.
|
101 | *
|
102 | * @default true
|
103 | */
|
104 | shouldHotReload?: boolean;
|
105 | /**
|
106 | * if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.
|
107 | *
|
108 | * @default false
|
109 | */
|
110 | shouldCatchErrors?: boolean;
|
111 | /**
|
112 | * If you want to restrict the extension, specify the features you allow.
|
113 | * If not specified, all of the features are enabled. When set as an object, only those included as `true` will be allowed.
|
114 | * Note that except `true`/`false`, `import` and `export` can be set as `custom` (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side.
|
115 | * Otherwise, you'll get/set the data right from the monitor part.
|
116 | */
|
117 | features?: {
|
118 | /**
|
119 | * start/pause recording of dispatched actions
|
120 | */
|
121 | pause?: boolean;
|
122 | /**
|
123 | * lock/unlock dispatching actions and side effects
|
124 | */
|
125 | lock?: boolean;
|
126 | /**
|
127 | * persist states on page reloading
|
128 | */
|
129 | persist?: boolean;
|
130 | /**
|
131 | * export history of actions in a file
|
132 | */
|
133 | export?: boolean | 'custom';
|
134 | /**
|
135 | * import history of actions from a file
|
136 | */
|
137 | import?: boolean | 'custom';
|
138 | /**
|
139 | * jump back and forth (time travelling)
|
140 | */
|
141 | jump?: boolean;
|
142 | /**
|
143 | * skip (cancel) actions
|
144 | */
|
145 | skip?: boolean;
|
146 | /**
|
147 | * drag and drop actions in the history list
|
148 | */
|
149 | reorder?: boolean;
|
150 | /**
|
151 | * dispatch custom actions or action creators
|
152 | */
|
153 | dispatch?: boolean;
|
154 | /**
|
155 | * generate tests for the selected actions
|
156 | */
|
157 | test?: boolean;
|
158 | };
|
159 | /**
|
160 | * Set to true or a stacktrace-returning function to record call stack traces for dispatched actions.
|
161 | * Defaults to false.
|
162 | */
|
163 | trace?: boolean | (<A extends Action>(action: A) => string);
|
164 | /**
|
165 | * The maximum number of stack trace entries to record per action. Defaults to 10.
|
166 | */
|
167 | traceLimit?: number;
|
168 | }
|
169 |
|
170 | export function composeWithDevTools<StoreExt, StateExt>(
|
171 | ...funcs: Array<StoreEnhancer<StoreExt>>
|
172 | ): StoreEnhancer<StoreExt>;
|
173 | export function composeWithDevTools(options: EnhancerOptions): typeof compose;
|
174 | export function devToolsEnhancer(options: EnhancerOptions): StoreEnhancer<any>;
|
175 |
|
\ | No newline at end of file |