Interface IRateLimiter<T, U, V>

A function whose invocations are rate limited and can be stopped after invocation before it has fired.

Typeparam

T - The resolved type of the underlying function. Defaults to any.

Typeparam

U - The rejected type of the underlying function. Defaults to any.

Typeparam

V - Arguments for the underlying function. Defaults to any[].

interface IRateLimiter<T, U, V> {
    isDisposed: boolean;
    limit: number;
    dispose(): void;
    invoke(...args): Promise<T>;
    stop(): Promise<void>;
}

Type Parameters

  • T = any
  • U = any
  • V extends any[] = any[]

Hierarchy (view full)

Implemented by

Properties

Methods

Properties

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

limit: number

The rate limit in milliseconds.

Methods

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void