import type { Fn } from 'everyday-types'; export interface Hooks { before?: () => void; after?: () => void; } export declare class QueueOptions { first: boolean; last: boolean; next: boolean; raf: boolean; task: boolean; time: boolean; atomic: boolean; concurrency?: number; debounce?: number; throttle?: number; hooks?: Hooks; } export declare const wrapQueue: (options?: Partial) =>

(queueFn: Fn) => Fn ? R : Promise>; /** * Decorate function `fn` with a queue function. * * The decorated function will returns a `Promise` that resolves with its result. * All calls will be resolved with latest result at any given quantum. * * Options: * - `first` => Run only first, then debounce. * - `last` => Run last (default behavior when using `debounce`). * - `next` => Run final subsequent call on next quantum (default behavior when nothing is set and not a `debounce`). * * - `raf` => Queue with `requestAnimationFrame`. * - `task` => Queue with `queueMicrotask`. * - `time` => Queue with `setTimeout`. * * - `debounce(ms)` => Debounce at specified `ms`. * - `throttle(ms)` => Throttle at specified `ms`. * * ```ts * fn = (x: number) => console.log(x) * * const cb = queue.task((x: number) => count += x) * cb(1) // passes (after task) * cb(2) // discarded * cb(3) // discarded * cb(4) // passes * * const cb = queue.task.last((x: number) => count += x) * cb(1) // discarded * cb(2) // discarded * cb(3) // discarded * cb(4) // passes * * const cb = queue.task.first((x: number) => count += x) * cb(1) // passes (before task) * cb(2) // discarded * cb(3) // discarded * cb(4) // discarded * * const cb = queue.task.first.last((x: number) => count += x) * cb(1) // passes (before task) * cb(2) // discarded * cb(3) // discarded * cb(4) // passes * * const cb = queue.task.first.last.next((x: number) => count += x) * cb(1) // passes (before task) * cb(2) // discarded * cb(3) // passes (after task) * cb(4) // passes (next task) * * const cb = queue.task.last.next((x: number) => count += x) * cb(1) // discarded * cb(2) // discarded * cb(3) // passes (after task) * cb(4) // passes (next task) * ``` */ export declare const queue: import("everyday-utils").Fluent<(

(queueFn: Fn) => Fn ? R : Promise>), Required>;