SubscribableValueEvent
class SubscribableValueEventT extends SubscribableTEventHandlerT
Provides safe access to the public interface of ValueDispatcher.
External classes can use it to subscribe to an event without being able to dispatch it.
Type Parameters
TThe type of the value passed to subscribers.
Constructors
constructor
public new SubscribableValueEventdispatcher: EventDispatcherBaseTEventHandlerT: SubscribableValueEventT
Parameters
dispatcher: EventDispatcherBaseTEventHandlerT
Subscribable.constructorAccessors
current
public get current(): T
Get the most recent value of this dispatcher.
Methods
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: EventHandlerTThe handler to invoke when the event occurs.
dispatchImmediately: boolean = trueWhether the handler should be immediately invoked with the most recent value.
Subscribable.subscribeunsubscribe
public unsubscribehandler: EventHandler: void
Unsubscribe from the event.
Parameters
handler: EventHandlerThe handler to unsubscribe.
Subscribable.unsubscribe