Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CallbacksInvoker

CallbacksInvoker is used to manager and invoke event listeners with different event keys, each key is mapped to a CallbackList.

Hierarchy

Index

Properties

_callbackTable

_callbackTable: ICallbackTable = createMap(true)

Methods

clear

  • clear(): void

emit

  • emit(key: string, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void
  • Trigger an event directly with the event name and necessary arguments.

    Parameters

    • key: string

      event type

    • Optional arg0: any

      The first argument to be passed to the callback

    • Optional arg1: any

      The second argument to be passed to the callback

    • Optional arg2: any

      The third argument to be passed to the callback

    • Optional arg3: any

      The fourth argument to be passed to the callback

    • Optional arg4: any

      The fifth argument to be passed to the callback

    Returns void

hasEventListener

  • hasEventListener(key: string, callback?: Function, target?: Object): boolean
  • Checks whether there is correspond event listener registered on the given event

    Parameters

    • key: string

      Event type

    • Optional callback: Function

      Callback function when event triggered

    • Optional target: Object

      Callback callee

    Returns boolean

off

  • off(key: string, callback?: Function, target?: Object): void
  • Remove event listeners registered with the given event key, callback and target

    Parameters

    • key: string

      Event type

    • Optional callback: Function

      The callback function of the event listener, if absent all event listeners for the given type will be removed

    • Optional target: Object

      The callback callee of the event listener

    Returns void

on

  • on(key: string, callback: Function, target?: Object, once?: undefined | false | true): Function
  • Register an event listener to a given event key with callback and target.

    Parameters

    • key: string

      Event type

    • callback: Function

      Callback function when event triggered

    • Optional target: Object

      Callback callee

    • Optional once: undefined | false | true

      Whether invoke the callback only once (and remove it)

    Returns Function

removeAll

  • removeAll(keyOrTarget: string | Object): void
  • Removes all callbacks registered in a certain event type or all callbacks registered with a certain target

    Parameters

    • keyOrTarget: string | Object

      The event type or target with which the listeners will be removed

    Returns void

Generated using TypeDoc