Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CallbacksInvoker

CallbacksInvoker 用来根据事件名(Key)管理事件监听器列表并调用回调方法。

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
  • 派发一个指定事件,并传递需要的参数

    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
  • 检查指定事件是否已注册回调。

    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
  • 删除以指定事件,回调函数,目标注册的回调。

    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
  • 向一个事件名注册一个新的事件监听器,包含回调函数和调用者

    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
  • 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。

    Parameters

    • keyOrTarget: string | Object

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

    Returns void

Generated using TypeDoc