class Signal<T>
package fivem.shared.util
A typed, in-process event emitter — the counterpart to FiveM's stringly
typed AddEventHandler for things that never leave the resource.
var onDeath = new Signal<Ped>();
var stop = onDeath.add(ped -> trace('${ped.handle} died'));
onDeath.dispatch(somePed);
stop();
Listeners added or removed during a dispatch don't affect the dispatch in flight: the listener list is snapshotted first. That makes the common "unsubscribe myself from inside my own handler" pattern safe.
Constructor
Variables
Methods
add(listener:T ‑> Void):SignalUnsubscribe
Attaches listener, returning a function that detaches it again.
once(listener:T ‑> Void):SignalUnsubscribe
Attaches listener for exactly one dispatch, then detaches it.