Clears the current cooldown. If suppressQueuedInvocation
is true
,
ignore/clear any queued invocation.
Note: If there is a queued invocation and it is not suppressed, the underlying function will be executed and the cooldown will restart.
Optional
suppressQueuedInvocation: booleanClears the currently-queued invocation, if any.
Force calling the underlying function, bypassing the cooldown.
Note: by default, calling this function will restart the cooldown period
and clear any queued invocations. See ForceFunctionCallSettings
to change
this behavior.
The return value of the underlying function
Optional
settings: ForceFunctionCallSettings<TArgs>Gets the internal handle for the current cooldown timeout. Use with caution!
undefined
if there is no active cooldown.
true
if the active cooldown is set to Infinity
a handle to the active cooldown timer.
Gets the most recent return value of the underlying function. If the function has not yet been called, returns undefined.
Gets stats about the ThrottledFunction
Returns true if the throttled function is currently in a cooldown state
Unregister a cooldown complete callback
Register a callback that is executed each time the cooldown ends. Return
a boolean to force calling (true
) or not calling (false
) the underlying
function, regardless of whether or not an invocation is queued.
If multiple callbacks return competing true/false values, the behavior is undefined.
Reference to the unmodified raw function. If this is called, it will not affect any cooldowns or queued invocations.
Rest
...args: TArgsResets/sets the throttled function into a fresh cooldown period. If
suppressQueuedInvocation
is true
, ignore/clear any queued invocation.
Optional
suppressQueuedInvocation: booleanSets args to be passed to the underlying function in subsequent calls.
Rest
...args: TArgsSets the cooldown period. All future cooldowns AFTER the currently running cooldown will use the new cooldown period.
Sets a queued invocation for when the current cooldown period ends.
Reference to the settings object for this throttled function with all defaults populated.
Generated using TypeDoc
Call the throttled function. Returns the value most recently-returned by the underlying function, or
undefined
if the function hasn't been called yet.