UNPKG

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