Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Event

Hierarchy

  • Event

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Event(opts?: { callbacks: Record<string, unknown> }): Event
  • Parameters

    • Optional opts: { callbacks: Record<string, unknown> }
      • callbacks: Record<string, unknown>

    Returns Event

Properties

Private callbacks

callbacks: Record<string, unknown> = {}

Static eventSplitter

eventSplitter: RegExp = ...

Methods

off

  • off(events?: any, callback?: any, context?: any): Event
  • 如果什么都不传就off全部事件

    Parameters

    • Optional events: any
    • Optional callback: any
    • Optional context: any

    Returns Event

on

  • on<T>(event: string, callback: Callback1<T>, context?: any): Event
  • on<T1, T2>(event: string, callback: Callback2<T1, T2>, context?: any): Event
  • on<T1, T2, T3>(event: string, callback: Callback3<T1, T2, T3>, context?: any): Event
  • on<T1, T2, T3, T4>(event: string, callback: Callback4<T1, T2, T3, T4>, context?: any): Event
  • on<T1, T2, T3, T4, T5>(event: string, callback: Callback5<T1, T2, T3, T4, T5>, context?: any): Event
  • on<T1, T2, T3, T4, T5, T6>(event: string, callback: Callback6Rest<T1, T2, T3, T4, T5, T6>, context?: any): Event
  • Type parameters

    • T

    Parameters

    • event: string
    • callback: Callback1<T>
    • Optional context: any

    Returns Event

  • Type parameters

    • T1

    • T2

    Parameters

    • event: string
    • callback: Callback2<T1, T2>
    • Optional context: any

    Returns Event

  • Type parameters

    • T1

    • T2

    • T3

    Parameters

    • event: string
    • callback: Callback3<T1, T2, T3>
    • Optional context: any

    Returns Event

  • Type parameters

    • T1

    • T2

    • T3

    • T4

    Parameters

    • event: string
    • callback: Callback4<T1, T2, T3, T4>
    • Optional context: any

    Returns Event

  • Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    Parameters

    • event: string
    • callback: Callback5<T1, T2, T3, T4, T5>
    • Optional context: any

    Returns Event

  • Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    Parameters

    • event: string
    • callback: Callback6Rest<T1, T2, T3, T4, T5, T6>
    • Optional context: any

    Returns Event

once

  • once(events: any, callback: any, context?: any): Event

trigger

  • trigger(event: string): Event
  • trigger<T1>(event: string, arg: T1): Event
  • trigger<T1, T2>(event: string, arg1: T1, arg2: T2): Event
  • trigger<T1, T2, T3>(event: string, arg1: T1, arg2: T2, arg3: T3): Event
  • trigger<T1, T2, T3, T4>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Event
  • trigger<T1, T2, T3, T4, T5>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): Event
  • trigger<T1, T2, T3, T4, T5, T6>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, ...rest: any[]): Event