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
TThe type of the value passed to subscribers.
Constructors
constructor
Type Parameters
Parameters
OverwritesEventDispatcherBase.constructorProperties
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.clearsubscribe
public override subscribehandler: EventHandlerTdispatchImmediately: boolean = true: () => void
Subscribe to the event.
Subscribing will immediately invoke the handler with the most recent value.
Parameters
handler: EventHandlerTThe handler to invoke when the event occurs.
dispatchImmediately: boolean = trueWhether the handler should be immediately invoked with the most recent value.
EventDispatcherBase.subscribeunsubscribe
public unsubscribehandler: EventHandlerT: void
Unsubscribe from the event.
Parameters
handler: EventHandlerTThe handler to unsubscribe.
EventDispatcherBase.unsubscribe