@toolcog/util/timer
Toolcog utilities
Functions
debounce()
debounce<
F
>(func
,interval
): (…args
) =>Promise
<Awaited
<ReturnType
<F
>>>
Returns a debounced wrapper function that delays invoking func
until
interval
milliseconds have elapsed since the last time it was invoked.
The debounced wrapper function returns a Promise
that resolves the next
time func
is called. The wrapper function never calls func
concurrently.
Type Parameters
• F extends (…args
) => unknown
Parameters
• func: F
• interval: number
Returns
Function
Parameters
• …args: Parameters
<F
>
Returns
Promise
<Awaited
<ReturnType
<F
>>>
bypass
readonly
bypass:F
cancel()
readonly
cancel: () =>void
Returns
void
force()
readonly
force: () =>Promise
<undefined
|Awaited
<ReturnType
<F
>>>
Returns
Promise
<undefined
| Awaited
<ReturnType
<F
>>>
Defined in
throttle()
throttle<
F
>(func
,interval
): (…args
) =>Promise
<Awaited
<ReturnType
<F
>>>
Returns a throttled wrapper function that invokes func
at most once
every interval
milliseconds. The throttled wrapper function returns
a Promise
that resolves the next time func
is called. The wrapper
function never calls func
concurrently.
Type Parameters
• F extends (…args
) => unknown
Parameters
• func: F
• interval: number
Returns
Function
Parameters
• …args: Parameters
<F
>
Returns
Promise
<Awaited
<ReturnType
<F
>>>
bypass
readonly
bypass:F
cancel()
readonly
cancel: () =>void
Returns
void
force()
readonly
force: () =>Promise
<undefined
|Awaited
<ReturnType
<F
>>>
Returns
Promise
<undefined
| Awaited
<ReturnType
<F
>>>