EmitterSubscription represents a subscription with listener and context data.

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

Hierarchy

  • EventSubscription
    • EmitterSubscription

Constructors

  • Parameters

    • emitter: EventEmitter

      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

    • context: any

      Optional context object to use when invoking the listener

    Returns EmitterSubscription

  • Parameters

    • subscriber: EventSubscriptionVendor

      the subscriber that controls this subscription.

    Returns EventSubscription

Properties

context: any
emitter: EventEmitter
eventType: string
key: number
listener: () => any
subscriber: EventSubscriptionVendor

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