ThrottledFunction
import { ThrottledFunction } from "jsr:@ende/async/unstable-throttle";interface ยท experimental
interface ThrottledFunction<T extends Array<unknown>>A throttled function that will be executed at most once during the
specified timeframe in milliseconds.
Call signatures
Call signature
(...args: T): voidProperties
throttling
readonly throttling: booleanReturns a boolean indicating whether the function is currently being throttled.
lastExecution
readonly lastExecution: numberReturns the timestamp of the last execution of the throttled function.
It is set to -Infinity if it has not been called yet, or reset is called after the last call.
Methods
clear
clear(): voidClears the throttling state.
ThrottledFunction.lastExecution will be reset to -Infinity and
ThrottledFunction.throttling will be reset to false.
flush
flush(): voidExecute the last throttled call (if any) and clears the throttling state.