Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventDispatcherForCommandMap

Custom implementation of EventDispatcher that will trigger command map each time EventDispatcher receives event dispatch

author

Jānis Radiņš

Hierarchy

Index

Constructors

constructor

Accessors

listenerCount

  • get listenerCount(): number

Methods

addEventListener

  • Add event listener.

    Parameters

    • event: string

      Event name for which to listen to

    • listener: EventListener

      Listener function that will be invoked as event with specified name is dispatched.

    • Optional scope: Object

      Listener scope which will be applied as listener is invoked. (You can leave it undefined, if you don't care about scope that much).

    Returns EventMapping

    Null in case if event name is already mapped to same function. Or EventMapping object which is to be used in order to set some of mapping properties like once() which will make listener to be executed upon first event dispatch and then be gone.

Private dispatchEvent

  • dispatchEvent(event: Event): boolean
  • dispatchEvent(eventType: string, eventData?: any): boolean

dispatchEventImpl

  • dispatchEventImpl(event: Event): boolean

hasEventListener

  • hasEventListener(event: string, listener?: EventListener, scope?: Object): boolean

listenOnce

  • Add event listener that will be executed only once.

    Parameters

    • event: string

      Event name for which to listen to

    • listener: EventListener

      Listener function that will be invoked as event with specified name is dispatched.

    • Optional scope: Object

      Listener scope which will be applied as listener is invoked. (You can leave it undefined, if you don't care about scope that much).

    Returns EventMapping

    Null in case if event name is already mapped to same function. Or EventMapping object which is to be used in order to set some of mapping properties like once() which will make listener to be executed upon first event dispatch and then be gone.

removeAllEventListeners

  • removeAllEventListeners(scope?: Object): boolean
  • Remove all listeners registered with specified scope or with the whole dispatcher instance.

    Parameters

    • Optional scope: Object

      Scope from which all listeners mapped listeners will be removed. If not specified, all listeners will be removed from whole dispatcher instance.

    Returns boolean

    True if any listeners to remove where found; false otherwise.

removeEventListener

  • removeEventListener(event: string, listener: EventListener, scope?: Object): boolean

removeEventListeners

  • removeEventListeners(eventType: string, scope?: Object): boolean
  • Remove all listeners of a particular event from all scopes or the specified scope.

    Parameters

    • eventType: string

      Event name to be unmapped from all listeners.

    • Optional scope: Object

      Listener scope from which all listeners mapped to eventType will be removed.

    Returns boolean

    True if any of mappings have been found; false otherwise.