Function: useSetTimeout()
useSetTimeout<
T>(callback,ms):TimeoutControl<T>
Defined in: src/core/services/timing.service.ts:21
Executes a callback after ms milliseconds, returning a cancellable
promise that resolves with the callback's result.
Type Parameters
T
T
The callback's return type.
Parameters
callback
() => T | Promise<T>
Function to execute after the delay.
ms
number
Delay in milliseconds.
Returns
A TimeoutControl with promise and cancel().
Example
const { promise, cancel } = useSetTimeout(() => 42, 1000);
cancel(); // rejects the promise with "Timeout cancelled"