Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Indexable

[propName: string]: any

Index

Properties

Methods

Properties

Private events

events: Event[] = []

储存事件的容器

Methods

Private addEvent

  • addEvent(name: string, eventType: EventType, execute: Function): string
  • 添加事件的方法

    Parameters

    • name: string
    • eventType: EventType
    • execute: Function

    Returns string

clear

emit

  • emit(name: string, ...args: any[]): EventBus
  • emit 派发事件

    Parameters

    • name: string

      事件名

    • Rest ...args: any[]

      其余参数

    Returns EventBus

    EventBus EventBus 实例

find

  • find(name: string): Event | null

on

  • on(name: string, execute: Function): string
  • on 新增事件监听

    Parameters

    • name: string

      事件名

    • execute: Function

      回调函数

    Returns string

    eventId 事件ID,用户取消该事件监听

once

  • once(name: string, execute: Function): string
  • one 只允许添加一次事件监听

    Parameters

    • name: string

      事件名

    • execute: Function

      回调函数

    Returns string

    eventId 事件ID,用户取消该事件监听

remove

  • remove(name: string, eventId?: undefined | string): EventBus
  • remove 移除事件监听

    Parameters

    • name: string

      事件名

    • Optional eventId: undefined | string

      移除单个事件监听需传入

    Returns EventBus

    EventBus EventBus 实例

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc