EventBus
Start from API_LEVEL
2.0
. Please refer to API_LEVEL.
EventBus is a tool class that provides event publishing/subscription.
Methods
on
Adds the listener function to the end of the listeners array for the event named eventName
on(eventName: string, listener: (...args: any[]) => void): void
off
Removes the specified listener from the listener array for the event named eventName
off(eventName: string, listener: (...args: any[]) => void): void
emit
Triggers the listener functions for the event named eventName
emit(eventName: string, ...args: any[]): void
once
Adds a one-time listener function for the event named eventName
once(eventName: string, listener: (...args: any[]) => void): void
clear
Removes all listeners, or those of the specified eventName
clear(): void