1 | import type { ThunkDispatch, ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
|
2 | export declare const onFocus: ActionCreatorWithoutPayload<"__rtkq/focused">;
|
3 | export declare const onFocusLost: ActionCreatorWithoutPayload<"__rtkq/unfocused">;
|
4 | export declare const onOnline: ActionCreatorWithoutPayload<"__rtkq/online">;
|
5 | export declare const onOffline: ActionCreatorWithoutPayload<"__rtkq/offline">;
|
6 | /**
|
7 | * A utility used to enable `refetchOnMount` and `refetchOnReconnect` behaviors.
|
8 | * It requires the dispatch method from your store.
|
9 | * Calling `setupListeners(store.dispatch)` will configure listeners with the recommended defaults,
|
10 | * but you have the option of providing a callback for more granular control.
|
11 | *
|
12 | * @example
|
13 | * ```ts
|
14 | * setupListeners(store.dispatch)
|
15 | * ```
|
16 | *
|
17 | * @param dispatch - The dispatch method from your store
|
18 | * @param customHandler - An optional callback for more granular control over listener behavior
|
19 | * @returns Return value of the handler.
|
20 | * The default handler returns an `unsubscribe` method that can be called to remove the listeners.
|
21 | */
|
22 | export declare function setupListeners(dispatch: ThunkDispatch<any, any, any>, customHandler?: (dispatch: ThunkDispatch<any, any, any>, actions: {
|
23 | onFocus: typeof onFocus;
|
24 | onFocusLost: typeof onFocusLost;
|
25 | onOnline: typeof onOnline;
|
26 | onOffline: typeof onOffline;
|
27 | }) => () => void): () => void;
|