state-decorator 7.0.0-beta.9-dev → 7.0.0-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +55 -24
  2. package/development.d.ts +10 -0
  3. package/development.js +2 -0
  4. package/development.js.map +1 -0
  5. package/graph.d.ts +8 -0
  6. package/helpers.js +1 -174
  7. package/helpers.js.map +1 -1
  8. package/impl.d.ts +20 -32
  9. package/impl.js +1 -996
  10. package/impl.js.map +1 -1
  11. package/index.d.ts +10 -11
  12. package/index.js +1 -1044
  13. package/index.js.map +1 -1
  14. package/middlewares.d.ts +0 -23
  15. package/middlewares.js +1 -526
  16. package/middlewares.js.map +1 -1
  17. package/package.json +2 -2
  18. package/shallow.d.ts +0 -14
  19. package/test.d.ts +7 -21
  20. package/test.js +1 -358
  21. package/test.js.map +1 -1
  22. package/types.d.ts +73 -72
  23. package/v5.d.ts +5 -18
  24. package/v5.js +1 -322
  25. package/v5.js.map +1 -1
  26. package/v5_test.d.ts +4 -17
  27. package/v5_test.js +1 -416
  28. package/v5_test.js.map +1 -1
  29. package/v5_types.d.ts +15 -29
  30. package/v6.d.ts +7 -3
  31. package/v6.js +1 -120
  32. package/v6.js.map +1 -1
  33. package/es/helpers.d.ts +0 -66
  34. package/es/helpers.js +0 -163
  35. package/es/helpers.js.map +0 -1
  36. package/es/impl.d.ts +0 -209
  37. package/es/impl.js +0 -964
  38. package/es/impl.js.map +0 -1
  39. package/es/index.d.ts +0 -164
  40. package/es/index.js +0 -1014
  41. package/es/index.js.map +0 -1
  42. package/es/middlewares.d.ts +0 -26
  43. package/es/middlewares.js +0 -520
  44. package/es/middlewares.js.map +0 -1
  45. package/es/shallow.d.ts +0 -15
  46. package/es/test.d.ts +0 -136
  47. package/es/test.js +0 -350
  48. package/es/test.js.map +0 -1
  49. package/es/types.d.ts +0 -381
  50. package/es/v5.d.ts +0 -58
  51. package/es/v5.js +0 -302
  52. package/es/v5.js.map +0 -1
  53. package/es/v5_test.d.ts +0 -70
  54. package/es/v5_test.js +0 -393
  55. package/es/v5_test.js.map +0 -1
  56. package/es/v5_types.d.ts +0 -227
  57. package/es/v6.d.ts +0 -17
  58. package/es/v6.js +0 -97
  59. package/es/v6.js.map +0 -1
package/es/types.d.ts DELETED
@@ -1,381 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) GlobalSport SAS.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- export declare type PromiseResult<Type> = Type extends Promise<infer X> ? X : null;
16
- export declare type NotifyFunc = (msg: string) => void;
17
- export declare type PromiseIdMap = {
18
- [promiseId: string]: boolean;
19
- };
20
- export declare type LoadingMap<A> = {
21
- [pId in keyof A]?: boolean;
22
- };
23
- export declare type LoadingParallelMap<A> = {
24
- [P in keyof A]?: PromiseIdMap;
25
- };
26
- export declare type InternalLoadingMap<A> = LoadingParallelMap<A>;
27
- export declare type LoadingProps<A> = {
28
- loading: boolean;
29
- loadingMap: LoadingMap<A>;
30
- loadingParallelMap: LoadingParallelMap<A>;
31
- };
32
- export declare type LoadingMapProps<A> = Pick<LoadingProps<A>, 'loadingMap'>;
33
- export declare type PromiseIdErrorMap = {
34
- [promiseId: string]: Error;
35
- };
36
- export declare type ErrorMap<A> = {
37
- [pId in keyof A]?: Error;
38
- };
39
- export declare type ErrorParallelMap<A> = {
40
- [P in keyof A]?: PromiseIdErrorMap;
41
- };
42
- export declare type ErrorProps<A> = {
43
- errorMap: ErrorMap<A>;
44
- };
45
- export interface DecoratedActions {
46
- [name: string]: (...args: any[]) => Promise<any> | void;
47
- }
48
- /**
49
- * The State decorator can manage only one asynchronous action of same name at a time.
50
- * This enum is enumertaing all the policies in such case.
51
- */
52
- export declare enum ConflictPolicy {
53
- /**
54
- * Reject the promise.
55
- */
56
- REJECT = "reject",
57
- /**
58
- * Return a resolved promise with no result.
59
- */
60
- IGNORE = "ignore",
61
- /**
62
- * Execute only the last call that conflicts after the one ongoing.
63
- */
64
- KEEP_LAST = "keepLast",
65
- /**
66
- * Execute all calls one after another.
67
- */
68
- KEEP_ALL = "keepAll",
69
- /**
70
- * Execute all calls one after another.
71
- * @see getPromiseId
72
- */
73
- PARALLEL = "parallel",
74
- /**
75
- * Reuse the ongoing promise if any and if possible (same arguments). Only for GET requests!
76
- */
77
- REUSE = "reuse"
78
- }
79
- export declare type PromiseProvider<S, DS, F extends (...args: any[]) => any, A, P> = (ctx: GetPromiseInvocationContext<S, DS, F, P, A>) => ReturnType<F> | null;
80
- /**
81
- * Simple form of a synchronous action.
82
- */
83
- export declare type SimpleSyncAction<S, F extends (...args: any[]) => any, P, DS, FxRes = Partial<S>> = (ctx: InvocationContext<S, DS, F, P>) => FxRes | null;
84
- export declare type SyncAction<S, F extends (...args: any[]) => any, A, P, DS, FxRes = Partial<S>> = {
85
- /**
86
- * Function that update the state when the action is called.
87
- */
88
- effects?: (ctx: EffectsInvocationContext<S, DS, F, P>) => FxRes | null;
89
- /**
90
- * Debounces the action if this parameter is defined.
91
- */
92
- debounceTimeout?: number;
93
- /**
94
- * Debounces the action side effects if this parameter is defined.
95
- */
96
- debounceSideEffectsTimeout?: number;
97
- /**
98
- * Function that calls side effects, ie. effects that are not changing the state directly.
99
- */
100
- sideEffects?: (ctx: SideEffectsInvocationContext<S, DS, F, P, A>) => void;
101
- };
102
- /**
103
- * Try to abort an action, if the action is <code>abortable</code>.
104
- * @param actionName The action name
105
- * @param promiseId If the action conflict type is <code>ConflictType.PARALLEL</code>, the identifier of the promise.
106
- * @returns <code>true</code> if the action is abortable and an action is ongoing, <code>false</code> otherwise.
107
- */
108
- export declare type AbortActionCallback<A> = (actionName: keyof A, promiseId?: string) => boolean;
109
- export declare type GetErrorMessage<S, DS, F extends (...args: any[]) => any, P> = (ctx: ErrorMessageInvocationContext<S, DS, F, P>) => string | null;
110
- export declare type ContextState<S> = {
111
- state: S;
112
- s: S;
113
- };
114
- export declare type ContextDerivedStateState<DS> = {
115
- derived: DS;
116
- ds: DS;
117
- };
118
- export declare type ContextBase<S, P> = ContextState<S> & {
119
- props: P;
120
- p: P;
121
- };
122
- export declare type ContextWithDerived<S, DS, P> = ContextBase<S, P> & ContextDerivedStateState<DS>;
123
- export declare type InvocationContextActions<A> = {
124
- actions: A;
125
- a: A;
126
- };
127
- export declare type WarningNotifyFunc = {
128
- notifyWarning?: NotifyFunc;
129
- };
130
- export declare type InvocationContext<S, DS, F extends (...args: any[]) => any, P> = ContextWithDerived<S, DS, P> & {
131
- args: Parameters<F>;
132
- promiseId: string;
133
- };
134
- export declare type EffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P> = InvocationContext<S, DS, F, P> & {
135
- result: PromiseResult<ReturnType<F>>;
136
- res: PromiseResult<ReturnType<F>>;
137
- };
138
- export declare type GetPromiseInvocationContext<S, DS, F extends (...args: any[]) => any, P, A> = InvocationContextActions<A> & InvocationContext<S, DS, F, P> & {
139
- abortSignal: AbortSignal;
140
- };
141
- export declare type ErrorEffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P> = InvocationContext<S, DS, F, P> & {
142
- error: Error;
143
- err: Error;
144
- };
145
- export declare type SuccessMessageInvocationContext<S, DS, F extends (...args: any[]) => any, P> = EffectsInvocationContext<S, DS, F, P>;
146
- export declare type ErrorMessageInvocationContext<S, DS, F extends (...args: any[]) => any, P> = ErrorEffectsInvocationContext<S, DS, F, P>;
147
- export declare type ClearErrorFunc<A> = (actionName: keyof A, promiseId?: string) => void;
148
- export declare type ClearError<A> = {
149
- clearError: ClearErrorFunc<A>;
150
- };
151
- export declare type SideEffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P, A> = EffectsInvocationContext<S, DS, F, P> & InvocationContextActions<A> & WarningNotifyFunc & ClearError<A>;
152
- export declare type ErrorSideEffectsInvocationContext<S, DS, F extends (...args: any[]) => any, P, A> = ErrorEffectsInvocationContext<S, DS, F, P> & InvocationContextActions<A> & WarningNotifyFunc;
153
- export declare type OnMountInvocationContext<S, A, P> = ContextBase<S, P> & InvocationContextActions<A>;
154
- export declare type AbortedActions<A> = Partial<Record<keyof A, string[]>>;
155
- export declare type OnUnMountInvocationContext<S, A, P> = ContextBase<S, P> & {
156
- abortedActions: AbortedActions<A>;
157
- };
158
- export declare type EffectsType = 'preEffects' | 'effects' | 'errorEffects' | 'optimisticEffects' | null;
159
- export declare type MiddlewareActionContext<S, A, P> = {
160
- name: keyof A;
161
- type: EffectsType;
162
- isAsync: boolean;
163
- context: InvocationContext<S, any, any, P>;
164
- };
165
- export declare type MiddlewareStoreContext<S, A extends DecoratedActions, P> = {
166
- actions: StoreActions<S, A, P, any, any>;
167
- state: S;
168
- setState: (s: S) => void;
169
- options: StoreOptions<S, A, P, any>;
170
- };
171
- export declare type MiddlewareFactory<S, A extends DecoratedActions, P> = () => Middleware<S, A, P>;
172
- /**
173
- * A state change middleware.
174
- * Allow to listen and change a state change on the fly.
175
- */
176
- export declare type Middleware<S, A extends DecoratedActions, P> = {
177
- /**
178
- * Initializes the middleware. Called when the store is initializing.
179
- */
180
- init: (storeContext: MiddlewareStoreContext<S, A, P>) => void;
181
- /**
182
- * Invoked on a state change has occurred and returns a new state or <code>null</code> if unchanged.
183
- */
184
- effects: (actionContext: MiddlewareActionContext<S, A, P>, oldState: S, newState: S, loading: boolean) => null | {
185
- state: S;
186
- loading: boolean;
187
- };
188
- /**
189
- * Destroys the middleware. Called when the store is being destroyed.
190
- */
191
- destroy: () => void;
192
- };
193
- export declare type AsyncActionBase<S, F extends (...args: any[]) => any, A, P, DS, FxRes = Partial<S>> = {
194
- /**
195
- * This action can be aborted. An abortSignal will be injected to the <code>promise</code> / <code>promiseGet</code>.
196
- */
197
- abortable?: boolean;
198
- /**
199
- * A function that provides the success message to pass to the notifySuccess function passed as property to the StateDecorator.
200
- */
201
- getSuccessMessage?: (ctx: SuccessMessageInvocationContext<S, DS, F, P>) => string;
202
- /**
203
- * A function that provides the error message to pass to the notifyError function passed as property to the StateDecorator.
204
- */
205
- getErrorMessage?: GetErrorMessage<S, DS, F, P>;
206
- /**
207
- * If set, called with the result of the promise to update the current state.
208
- */
209
- effects?: (ctx: EffectsInvocationContext<S, DS, F, P>) => FxRes | null;
210
- /**
211
- * If set, called with the error of the promise to update the current state.
212
- */
213
- errorEffects?: (ctx: ErrorEffectsInvocationContext<S, DS, F, P>) => FxRes | null;
214
- /**
215
- * Whether reject the promise instead of handling it.
216
- */
217
- rejectPromiseOnError?: boolean;
218
- /**
219
- * When the error will not be managed by an errorEffect, errorSideEffect, getErrorMessage,
220
- * the state decorator will not display an error message and will not return a failed promise
221
- * (unless <code>rejectPromiseOnError</code>) is set.
222
- */
223
- isErrorManaged?: boolean;
224
- /**
225
- * Handle side effects when the request succeeded.
226
- * @param result The result of the request
227
- * @param newData The data after the reducer is applied
228
- * @param args The argument during the call of the request function
229
- * @param props The props passed to the state decorator
230
- * @param actions The actions available
231
- * @param notifyWarning If specified, a notify function to indicate that the action is a semi success (use successMessage / getSuccessMessage otherwise).
232
- */
233
- sideEffects?: (ctx: SideEffectsInvocationContext<S, DS, F, P, A>) => void;
234
- /**
235
- * Handle side effects when the request failed.
236
- * @param error The error of the request
237
- * @param args The argument during the call of the request function
238
- * @param props The props passed to the state decorator
239
- * @param actions The actions available
240
- * @param notifyWarning If specified, a notify function to indicate that the action is a semi failure (use errorMessage / getErrorMessage otherwise).
241
- */
242
- errorSideEffects?: (ctx: ErrorSideEffectsInvocationContext<S, DS, F, P, A>) => void;
243
- /**
244
- * Retrieve the state to set as current data before the promise is resolved.
245
- * If the there's no reducer, this data will be used after the promise is done.
246
- */
247
- preEffects?: (ctx: InvocationContext<S, DS, F, P>) => FxRes | null;
248
- /**
249
- * Retrieve the state to set as current data before the promise is resolved.
250
- * If the there's no reducer, this data will be used after the promise is done.
251
- */
252
- optimisticEffects?: (ctx: InvocationContext<S, DS, F, P>) => FxRes | null;
253
- /**
254
- * Policy to apply when a call to an asynchronous action is done but a previous call is still not resolved.
255
- */
256
- conflictPolicy?: ConflictPolicy;
257
- /**
258
- * Get an identifier for an action call. Used only when conflictPolicy is ConflictPolicy.PARALLEL.
259
- * This information will be available in loadingMap. loadingMap[actionName] will be an array of promise identifiers.
260
- */
261
- getPromiseId?: (...args: Parameters<F>) => string;
262
- /**
263
- * Number of retries in case of error (failed to fetch).
264
- * Do not use this if you are creating objects...
265
- * Default value is 0 (no retry).
266
- */
267
- retryCount?: number;
268
- /**
269
- * Seed of delay between each retry in milliseconds.
270
- * The applied delay is retryDelaySeed * retry count.
271
- * Default value is 1000 (1 second).
272
- */
273
- retryDelaySeed?: number;
274
- /**
275
- * Function to test if the error will trigger an action retry or will fail directly.
276
- */
277
- isTriggerRetryError?: (e: Error) => boolean;
278
- };
279
- export declare type AsyncActionPromise<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = Partial<S>> = AsyncActionBase<S, F, A, P, DS, FxRes> & {
280
- /**
281
- * The request, returns a promise
282
- */
283
- getPromise: PromiseProvider<S, DS, F, A, P>;
284
- };
285
- export declare type AsyncActionPromiseGet<S, F extends (...args: any[]) => any, A, P, DS, FxRes = Partial<S>> = AsyncActionBase<S, F, A, P, DS, FxRes> & {
286
- /**
287
- * The request, returns a promise that is a GET request.
288
- * A shortcut to set:
289
- * - retryCount: 3
290
- * - conflictPolicy: ConflictPolicy.REUSE
291
- */
292
- getGetPromise: PromiseProvider<S, DS, F, A, P>;
293
- };
294
- export declare type AsyncAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = Partial<S>> = AsyncActionPromise<S, F, A, P, DS, FxRes> | AsyncActionPromiseGet<S, F, A, P, DS, FxRes>;
295
- export declare type StoreAction<S, F extends (...args: any[]) => any, A, P, DS = {}, FxRes = Partial<S>> = AsyncAction<S, F, A, P, DS, FxRes> | SimpleSyncAction<S, F, P, DS, FxRes> | SyncAction<S, F, A, P, DS, FxRes>;
296
- /**
297
- * S: The type of the state
298
- * A: The type of the actions to pass to the children (used to check keys only).
299
- */
300
- export declare type StoreActions<S, A extends DecoratedActions, P = {}, DS = {}, FxRes = Partial<S>> = {
301
- [Prop in keyof A]: StoreAction<S, A[Prop], A, P, DS, FxRes>;
302
- };
303
- export declare type OnPropsChangeEffectsContext<S, DS, P> = ContextWithDerived<S, DS, P> & {
304
- indices: number[];
305
- index: number;
306
- isInit: boolean;
307
- getInitialState: (p: P) => S;
308
- };
309
- export declare type OnPropsChangeSideEffectsContext<S, P, A, DS = {}> = OnPropsChangeEffectsContext<S, DS, P> & {
310
- actions: A;
311
- a: A;
312
- };
313
- declare type DerivedStateOption<S, P, DS> = {
314
- [k in keyof DS]: {
315
- getDeps: (ctx: ContextBase<S, P>) => any[];
316
- get: (ctx: ContextBase<S, P>) => DS[k];
317
- };
318
- };
319
- export declare type OnPropsChangeOptions<S, DS, A, P> = {
320
- onMount?: boolean;
321
- onMountDeferred?: boolean;
322
- getDeps: (p: P) => any[];
323
- effects?: (ctx: OnPropsChangeEffectsContext<S, DS, P>) => Partial<S>;
324
- sideEffects?: (ctx: OnPropsChangeSideEffectsContext<S, P, A>) => void;
325
- };
326
- export declare type StoreOptions<S, A, P = {}, DS = {}> = {
327
- /**
328
- * The state decorator name. Use in debug traces to identify the useStateDecorator instance.
329
- */
330
- name?: string;
331
- /**
332
- * Indicates that all asynchronous actions errors are managed externally.
333
- * Same as setting isErrorManaged to true for all actions.
334
- */
335
- isErrorManaged?: boolean;
336
- /**
337
- * List of action names that are marked as loading at initial time.
338
- * If you must start your initial actions in a useSideEffect, a render is done before
339
- * first actions can be trigerred, some actions can be marked as loading at initial time.
340
- */
341
- initialActionsMarkedLoading?: (keyof A)[];
342
- /**
343
- * One or several configurations of inbound properties change managements.
344
- */
345
- onPropsChange?: OnPropsChangeOptions<S, DS, A, P> | OnPropsChangeOptions<S, DS, A, P>[];
346
- /**
347
- * The callback function called if an asynchronous function succeeded and a success messsage is defined.
348
- */
349
- notifySuccess?: NotifyFunc;
350
- /**
351
- * The callback function called if an asynchronous function fails and an error messsage is defined.
352
- */
353
- notifyError?: NotifyFunc;
354
- /**
355
- * The callback function injected in onDone and onFail of asynchronous functions to notify a semi success / failed request.
356
- */
357
- notifyWarning?: NotifyFunc;
358
- /**
359
- * Initial actions.
360
- */
361
- onMount?: (ctx: OnMountInvocationContext<S, A, P>) => void;
362
- /**
363
- * Initial actions executed after initial render.
364
- *
365
- */
366
- onMountDeferred?: (ctx: OnMountInvocationContext<S, A, P>) => void;
367
- /**
368
- * Callback on store destruction.
369
- */
370
- onUnmount?: (ctx: OnUnMountInvocationContext<S, A, P>) => Promise<any> | void;
371
- /**
372
- * Compute derived state
373
- */
374
- derivedState?: DerivedStateOption<S, P, DS>;
375
- };
376
- export declare type StoreConfig<S, A extends DecoratedActions, P = {}, DS = {}> = {
377
- getInitialState: S | ((p: P) => S);
378
- actions: StoreActions<S, A, P, DS>;
379
- middlewares?: MiddlewareFactory<S, A, P>[];
380
- } & StoreOptions<S, A, P, DS>;
381
- export {};
package/es/v5.d.ts DELETED
@@ -1,58 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) GlobalSport SAS.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- import { DecoratedActions, MiddlewareFactory } from './types';
16
- import { setGlobalConfig, ConflictPolicy } from './index';
17
- import { AdvancedSynchAction, AsynchActionPromiseGet, StateDecoratorAction, StateDecoratorActions, StateDecoratorOptions, AsynchActionPromise, SynchAction, LoadingMap, LoadingProps, LoadingMapParallelActions, AsynchAction } from './v5_types';
18
- export { AdvancedSynchAction, AsynchActionPromiseGet, StateDecoratorAction, StateDecoratorActions, StateDecoratorOptions, AsynchActionPromise, SynchAction, LoadingMap, LoadingMapParallelActions, LoadingProps, ConflictPolicy, setGlobalConfig, };
19
- /**
20
- * Type guard function to test if an action is a asynchronous action.
21
- */
22
- export declare function isAsyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is AsynchAction<S, F, A, P>;
23
- /**
24
- * Type guard function to test if an action is a asynchronous action.
25
- */
26
- export declare function isAsyncPromiseGetAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is AsynchActionPromiseGet<S, F, A, P>;
27
- /**
28
- * Type guard function to test if an action is a synchronous action.
29
- */
30
- export declare function isSyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is SynchAction<S, F, P>;
31
- /**
32
- * Type guard function to test if an action is a synchronous action.
33
- */
34
- export declare function isAdvancedSyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is AdvancedSynchAction<S, F, A, P>;
35
- declare function useStateDecorator<S, A extends DecoratedActions, P>(getInitialState: (props: P) => S, actions: StateDecoratorActions<S, A, P>, props: P, options?: StateDecoratorOptions<S, A, P>, middlewares?: MiddlewareFactory<S, A, P>[]): {
36
- state: S & {};
37
- actions: A;
38
- loading: boolean;
39
- loadingMap: import("./types").LoadingMap<A>;
40
- loadingParallelMap: import("./types").LoadingParallelMap<A>;
41
- abortAction: (actionName: keyof A, promiseId?: string) => boolean;
42
- };
43
- export default useStateDecorator;
44
- /**
45
- * Hook to execute a function when hook is mounted.
46
- * @param onMount function to execute on the hook nount
47
- */
48
- export declare function useOnMount(onMount: () => any): void;
49
- /**
50
- * Hook to execute a function when hook is unmounted.
51
- * @param onUnMount function to execute on the hook nount
52
- */
53
- export declare function useOnUnmount(onUnmount: () => void, propList?: any[]): void;
54
- /**
55
- * Hook to execute a function when hook is unmounted.
56
- * @param onUnMount function to execute on the hook nount
57
- */
58
- export declare function useOnUnload(onUnload: () => void): void;