Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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