EmitterSubscription represents a subscription with listener and context data.

interface EmitterSubscription {
    new EmitterSubscriptionnew (emitter, subscriber, listener, context): EmitterSubscription;
    new EmitterSubscriptionnew (subscriber): EventSubscription;
    context: any;
    emitter: default;
    eventType: string;
    key: number;
    listener: (() => any);
    subscriber: EventSubscriptionVendor;
    remove(): void;
}

Hierarchy (view full)

Constructors

  • Parameters

    • emitter: default

      The event emitter that registered this subscription

    • subscriber: EventSubscriptionVendor

      The subscriber that controls this subscription

    • listener: (() => any)

      Function to invoke when the specified event is emitted

        • (): any
        • Returns any

    • context: any

      Optional context object to use when invoking the listener

    Returns EmitterSubscription

  • Parameters

    Returns EventSubscription

Properties

context: any
emitter: default
eventType: string
key: number
listener: (() => any)

Type declaration

    • (): any
    • Returns any

Methods

  • Removes this subscription from the emitter that registered it. Note: we're overriding the remove() method of EventSubscription here but deliberately not calling super.remove() as the responsibility for removing the subscription lies with the EventEmitter.

    Returns void