ValueDispatcher
class ValueDispatcherT extends EventDispatcherBaseT
Dispatches a SubscribableValueEvent
Changing the value stored by a value dispatcher will immediately notify all its subscribers.
Examples
Type Parameters
T
The type of the value passed to subscribers.
Constructors
constructor
Type Parameters
Parameters
OverwritesEventDispatcherBase.constructor
Properties
subscribable
readonly public subscribable: SubscribableValueEventT = ...
Accessors
current
Set the current value of this dispatcher.
Setting the value will immediately notify all subscribers.
Parameters
Methods
clear
public clear(): void
Unsubscribe all subscribers from the event.
Inherited fromEventDispatcherBase.clear
subscribe
public override subscribehandler: EventHandlerTdispatchImmediately: boolean = true: () => void
Subscribe to the event.
Subscribing will immediately invoke the handler with the most recent value.
Parameters
handler: EventHandlerT
The handler to invoke when the event occurs.
dispatchImmediately: boolean = true
Whether the handler should be immediately invoked with the most recent value.
EventDispatcherBase.subscribe
unsubscribe
public unsubscribehandler: EventHandlerT: void
Unsubscribe from the event.
Parameters
handler: EventHandlerT
The handler to unsubscribe.
EventDispatcherBase.unsubscribe