UNPKG

1.1 kBTypeScriptView Raw
1declare type NotifyCallback = () => void;
2declare type NotifyFunction = (callback: () => void) => void;
3declare type BatchNotifyFunction = (callback: () => void) => void;
4export declare class NotifyManager {
5 private queue;
6 private transactions;
7 private notifyFn;
8 private batchNotifyFn;
9 constructor();
10 batch<T>(callback: () => T): T;
11 schedule(callback: NotifyCallback): void;
12 /**
13 * All calls to the wrapped function will be batched.
14 */
15 batchCalls<T extends Function>(callback: T): T;
16 flush(): void;
17 /**
18 * Use this method to set a custom notify function.
19 * This can be used to for example wrap notifications with `React.act` while running tests.
20 */
21 setNotifyFunction(fn: NotifyFunction): void;
22 /**
23 * Use this method to set a custom function to batch notifications together into a single tick.
24 * By default React Query will use the batch function provided by ReactDOM or React Native.
25 */
26 setBatchNotifyFunction(fn: BatchNotifyFunction): void;
27}
28export declare const notifyManager: NotifyManager;
29export {};