Signals are a type-safe system to emit events. A signal will calls its listeners whenever something (the event that the signal represents) happens, passing along any relevant associated data.

Signals which have no associated data should use haxe.NoData as their type parameter.

Variables

read onlylistenerCount:Int

Number of listeners to this signal.

Methods

emit (data:T):Void

Emits data to all current listeners of this signal.

off (?listener:Listener<T>):Void

Removes the given listener from this signal.

on (listener:Listener<T>):Void

Adds a listener to this signal, which will be called for all signal emissions until it is removed with off.

once (listener:Listener<T>):Void

Adds a listener to this signal, which will be called only once, the next time the signal emits.