Class RaceConditionFreeSubscription

Avoid race conditions when store disposable resources, such as the execution of an Observable.

Hierarchy

  • RaceConditionFreeSubscription

Constructors

Methods

Constructors

Methods

  • Creates a race condition free disposable resource, such as the execution of an Observable associated with a key that will be unsubscribed before subscribing again if the key and args are used again or the subscription is closed.

    Parameters

    • key: string

      The unique key associated to the Subscription.

    • subscriptionFn: (() => Subscription)

      A function that returns a disposable resource, such as the execution of an Observable.

        • (): Subscription
        • Returns Subscription

    • Optional Rest ...args: unknown[]

      Arguments required to create the disposable resource.

    Returns void

  • Gets a disposable resource, such as the execution of an Observable, associated with the key or undefined if the key does not exist.

    Returns

    A disposable resource, such as the execution of an Observable, or undefined if the key does not exist.

    Parameters

    • key: string

      The unique key associated to the Subscription.

    Returns undefined | Subscription

  • Disposes the resource held by the safe subscriptions associated with the keys or all the resources if a key is not provided.

    Parameters

    • Optional Rest ...keys: string[]

      The list of keys associated to the Subscriptions.

    Returns void

Generated using TypeDoc