Skip to main content

Interface: RateLimitedFunction()<A>

Defined in: use-rate-limited-callback.ts:50

A rate-limited function returned by useRateLimitedCallback, with controls to inspect and clear the limiter.

Type Parameters​

A​

A extends unknown[]

The argument list of the limited callback.

RateLimitedFunction(...args): boolean

Defined in: use-rate-limited-callback.ts:57

Calls the callback if a token is left, otherwise drops or queues the call.

Parameters​

args​

...A

Returns​

boolean

true if the call ran now or was added to the queue, false if it was dropped.

Properties​

cancel​

cancel: () => void

Defined in: use-rate-limited-callback.ts:59

Discard every queued call. Tokens already spent are not refunded.

Returns​

void


pending​

pending: () => number

Defined in: use-rate-limited-callback.ts:63

The number of calls waiting in the queue.

Returns​

number


remaining​

remaining: () => number

Defined in: use-rate-limited-callback.ts:61

The whole number of calls that would run right now.

Returns​

number