sesaparcours
    Preparing search index...

    Class EventGeneratorAbstract

    Base class for classes that wish to support binding and firing of events.

    You need to implement the shouldFireEvent method in your concrete subclasses of this class, or you can instead extend from OptimisticEventGenerator, which has a default implementation of shouldFireEvent that returns true.

    Hierarchy (View Summary)

    Index

    Constructors

    • Returns EventGenerator

    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 | String[]

        Name of the event(s) to bind to.

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

        Function to bind to the given event(s)

      • OptionalinsertAtStart: 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

      • Optionalvalue: T

        Value to pass to event handlers

      • OptionaloriginalEvent: 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[]

    • Returns whether not event firing is currently suspended

      Returns boolean

    • Sets whether not event firing is currently suspended

      Parameters

      • val: boolean

      Returns void

    • Run the given function without firing any events.

      Parameters

      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

      • OptionaleventOrListener: string | Function

        Either an event name, or an event handler function

      • Optionallistener: Function

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

      Returns EventGenerator