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
T
The type of the value passed to subscribers.
Constructors
constructor
public new SubscribableValueEventTdispatcher: EventDispatcherBaseTEventHandlerT: SubscribableValueEventT
Type Parameters
Parameters
Inherited fromSubscribable.constructor
Accessors
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: EventHandlerT
The handler to invoke when the event occurs.
dispatchImmediately: boolean = true
Whether the handler should be immediately invoked with the most recent value.
Subscribable.subscribe
unsubscribe
public unsubscribehandler: EventHandlerT: void
Unsubscribe from the event.
Parameters
handler: EventHandlerT
The handler to unsubscribe.
Subscribable.unsubscribe