BeEvent<T extends Listener> Class

Manages a set of listeners for a particular event and notifies them when the event is raised. This class is usually instantiated inside of a container class and exposed as a property for others to subscribe via BeEvent.addListener.

Extended by

Methods

Name Description
constructor<T extends Listener>(): BeEvent<T>    
addListener(listener: T, scope?: any): () => void Registers a Listener to be executed whenever this event is raised.  
addOnce(listener: T, scope?: any): () => void Registers a callback function to be executed only once when the event is raised.  
clear(): void Clear all Listeners from this BeEvent.  
has(listener: T, scope?: any): boolean Determine whether this BeEvent has a specified listener registered.  
raiseEvent(...args: Parameters<T>): void Raises the event by calling each registered listener with the supplied arguments.  
removeListener(listener: T, scope?: any): boolean Un-register a previously registered listener.  

Properties

Name Type Description
numberOfListeners Accessor ReadOnly number The number of listeners currently subscribed to the event.  

Defined in

Last Updated: 20 June, 2023