SubscribableValueEvent
class
SubscribableValueEvent
T
extends
Subscribable
T
EventHandler
T
Provides safe access to the public interface of
ValueDispatcher
.
External classes can use it to subscribe to an event without being able todispatch it.
Type Parameters
-
TThe type of the value passed to subscribers.
Constructors
constructor
public
new
SubscribableValueEvent
T
dispatcher
:
EventDispatcherBase
T
EventHandler
T
:
SubscribableValueEvent
T
Type Parameters
Parameters
-
dispatcher : EventDispatcherBase T EventHandler T
Subscribable.constructor
Accessors
current
public
get
current
():
T
Get the most recent value of this dispatcher.
Methods
subscribe
public
override
subscribe
handler
:
EventHandler
T
dispatchImmediately
:
boolean
=
true
: () =>
void
Subscribe to the event.
Subscribing will immediately invoke the handler with the most recent value.
Parameters
-
handler : EventHandler TThe handler to invoke when the event occurs.
-
dispatchImmediately : boolean = trueWhether the handler should be immediatelyinvoked with the most recent value.
Subscribable.subscribe
unsubscribe
public
unsubscribe
handler
:
EventHandler
T
:
void
Unsubscribe from the event.
Parameters
-
handler : EventHandler TThe handler to unsubscribe.
Subscribable.unsubscribe