Files
klz-cables.com/.pnpm-store/v10/files/e9/a52b1028351e5568df59542d520219e83b534d2962dc58b02ea9d26fb5568468b4d445b0f1bb84341044d32adb9cc74ad30e03011d277365fe0cee68d1223c
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

37 lines
1.5 KiB
Plaintext

type QueuedFunction = () => Promise<void>;
type QueuedTaskOptions = {
/**
* A function that is called after the queue has processed a function
* Used to perform side effects after processing the queue
* @returns {void}
*/
afterProcess?: () => void;
/**
* A function that can be used to prevent the queue from processing under certain conditions
* Can also be used to perform side effects before processing the queue
* @returns {boolean} If `false`, the queue will not process
*/
beforeProcess?: () => boolean | void;
};
type QueueTask = (fn: QueuedFunction, options?: QueuedTaskOptions) => void;
/**
* A React hook that allows you to queue up functions to be executed in order.
* This is useful when you need to ensure long running networks requests are processed sequentially.
* Builds up a "queue" of functions to be executed in order, only ever processing the last function in the queue.
* This ensures that a long queue of tasks doesn't cause a backlog of tasks to be processed.
* E.g. if you queue a task and it begins running, then you queue 9 more tasks:
* 1. The currently task will finish
* 2. The next task in the queue will run
* 3. All remaining tasks will be discarded
* @returns {queueTask} A function used to queue a function.
* @example
* const { queueTask } = useQueue()
* queueTask(async () => {
* await fetch('https://api.example.com')
* })
*/
export declare function useQueue(): {
queueTask: QueueTask;
};
export {};
//# sourceMappingURL=useQueue.d.ts.map