interface SubscribableMixin {
    addListenerOn(eventEmitter, eventType, listener, context): void;
}

Hierarchy (view full)

Methods

  • Special form of calling addListener that guarantees that a subscription must be tied to a component instance, and therefore will be cleaned up when the component is unmounted. It is impossible to create the subscription and pass it in - this method must be the one to create the subscription and therefore can guarantee it is retained in a way that will be cleaned up.

    Parameters

    • eventEmitter: any

      emitter to subscribe to.

    • eventType: string

      Type of event to listen to.

    • listener: (() => any)

      Function to invoke when event occurs.

        • (): any
        • Returns any

    • context: any

      Object to use as listener context.

    Returns void