addOnce Method

Registers a callback function to be executed only once when the event is raised.

addOnce(listener: T, scope?: any): () => void

@returns A function that will remove this event listener.

@see BeEvent.raiseEvent, BeEvent.removeListener

Parameter Type Description
listener T The function to be executed once when the event is raised.
scope any An optional object scope to serve as the this pointer in which the listener function will execute.

Returns - () => void

A function that will remove this event listener.

Defined in

Last Updated: 25 April, 2024