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 SubscribableValueEventTdispatcher: EventDispatcherBaseTEventHandlerT: SubscribableValueEventT
Type Parameters
Parameters
Inherited fromSubscribable.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: EventHandlerT: void
Unsubscribe from the event.
Parameters
handler: EventHandlerTThe handler to unsubscribe.
Subscribable.unsubscribe