import { EventChannel, Task } from 'redux-saga'; import { SelectorChannelPayload, SelectorChannelSelector, SelectorWorkerSaga } from '../types'; export type { SelectorChannelPayload, SelectorChannelSelector, SelectorWorkerSaga, } from '../types'; /** * Creates an event channel from a selector that emits when the selector value changes. * The channel must be closed when no longer needed to prevent memory leaks. * * Usage: * ```typescript * const channel = yield* createChannelFromSelector(mySelector, arg1, arg2); * try { * while (true) { * const { payload, prevPayload } = yield* take(channel); * // handle value change * } * } finally { * channel.close(); * } * ``` * * @param selector - The store selector to watch * @param args - Arguments to pass to the selector * @returns An event channel that emits { payload, prevPayload } on value changes */ export declare function createChannelFromSelector(selector: SelectorChannelSelector, ...args: ARGS): Generator>, any>; /** * Forks a task that spawns a new worker for each selector value change. * Similar to `takeEvery` but: * - Creates the channel from the selector automatically * - Closes the channel when the saga is cancelled or fails * - Automatically forks itself (no need to wrap in fork()) * * @param selector - The store selector to watch * @param argsOrWorker - Arguments to pass to the selector, or the worker if no args needed * @param worker - Worker saga to run for each value change (optional if argsOrWorker is the worker) */ export declare function takeEveryFromSelector(selector: SelectorChannelSelector, worker: SelectorWorkerSaga): Generator; export declare function takeEveryFromSelector(selector: SelectorChannelSelector, args: ARGS, worker: SelectorWorkerSaga): Generator; /** * Forks a task that cancels previous worker and spawns a new one for each selector value change. * Similar to `takeLatest` but: * - Creates the channel from the selector automatically * - Closes the channel when the saga is cancelled or fails * - Automatically forks itself (no need to wrap in fork()) * * @param selector - The store selector to watch * @param argsOrWorker - Arguments to pass to the selector, or the worker if no args needed * @param worker - Worker saga to run for each value change (optional if argsOrWorker is the worker) */ export declare function takeLatestFromSelector(selector: SelectorChannelSelector, worker: SelectorWorkerSaga): Generator; export declare function takeLatestFromSelector(selector: SelectorChannelSelector, args: ARGS, worker: SelectorWorkerSaga): Generator; /** * Forks a task that ignores new values while a worker is running. * Similar to `takeLeading` but: * - Creates the channel from the selector automatically * - Closes the channel when the saga is cancelled or fails * - Automatically forks itself (no need to wrap in fork()) * * @param selector - The store selector to watch * @param argsOrWorker - Arguments to pass to the selector, or the worker if no args needed * @param worker - Worker saga to run (optional if argsOrWorker is the worker) */ export declare function takeLeadingFromSelector(selector: SelectorChannelSelector, worker: SelectorWorkerSaga): Generator; export declare function takeLeadingFromSelector(selector: SelectorChannelSelector, args: ARGS, worker: SelectorWorkerSaga): Generator; //# sourceMappingURL=selector-channel-effects.d.ts.map