Subclass of EventGenerator with a default implementation of shouldFireEvent, which returns true always.

Hierarchy (view full)

Methods

  • Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.

    Type Parameters

    • T = any

    Parameters

    • event: string

      Name of the event(s) to bind to.

    • listener: ((a, e?) => any)

      Function to bind to the given event(s)

        • (a, e?): any
        • Parameters

          • a: T
          • Optional e: any

          Returns any

    • Optional insertAtStart: boolean

      Whether or not to insert this listener at the head of the listener queue. Defaults to false.

    Returns EventGenerator

  • Fire the named event.

    Type Parameters

    • T

    Parameters

    • event: string

      Event to fire

    • Optional value: T

      Value to pass to event handlers

    • Optional originalEvent: Event

      Optional original event that caused this event to be fired.

    Returns any

  • Gets all listeners for the given named event.

    Parameters

    • forEvent: string

    Returns any[]

  • Sets whether not event firing is currently suspended

    Parameters

    • val: boolean

    Returns void

  • Run the given function without firing any events.

    Parameters

    • fn: Function

    Returns void

  • Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.

    Parameters

    • Optional eventOrListener: string | Function

      Either an event name, or an event handler function

    • Optional listener: Function

      If eventOrListener is defined, this is the event handler to unbind.

    Returns EventGenerator