Interface AsyncSubscriptionFunctions<This, Args>

Functions used to asynchronously subscribe and unsubscribe to an event.

Type Parameters

  • This

  • Args extends any[] = []

Hierarchy

Implemented by

Methods

  • Returns AsyncIterator<Args, any, undefined>

  • Create a subscribable that will apply the specified filter to any listeners added.

    Parameters

    • filter: ((this, ...args) => boolean | Promise<boolean>)

      function used to filter events

        • (this, ...args): boolean | Promise<boolean>
        • Parameters

          • this: This
          • Rest ...args: Args

          Returns boolean | Promise<boolean>

    Returns AsyncSubscribable<This, Args>

    filtered AsyncSubscribable

  • Create an iterator that supports async iteration of events emitted.

    Parameters

    Returns AsyncIterableIterator<Args>

    iterable/iterator

  • Get a promise that will resolve the first time this event is fired after this call.

    Returns Promise<Args>

    promise that resolves the next time the event is fired

  • Subscribe to this event using the given listener. The listener will be invoked any time the event is emitted. The returned handle can be used to unsubscribe.

    Parameters

    • listener: Listener<This, Args>

      listener to subscribe

    Returns Promise<AsyncSubscriptionHandle>

    promise with handle to the subscription, can be used to unsubscribe. Resolves when the subscription is fully registered

  • Unsubscribe a listener from this handler. The specified listener will no longer be invoked when the event is emitted.

    Parameters

    • listener: Listener<This, Args>

      listener to unsubscribe

    Returns Promise<void>

    promise that resolves when the listener is unsubscribed

  • Create a Subscribable that changes the this argument used for listeners.

    Type Parameters

    • NewThis

    Parameters

    • newThis: NewThis

      what should be treated as this for event listeners

    Returns AsyncSubscribable<NewThis, Args>

    modified AsyncSubscribable

Generated using TypeDoc