FlagDispatcher
class
FlagDispatcher
extends
EventDispatcherBase
void
Dispatches a
SubscribableFlagEvent
.
Subscribers are notified only when the flag is set.Subsequent calls to
raise
don't trigger anything.Any handlers added while the flag is raised are immediately invoked.
Resetting the flag doesn't notify the subscribers, but raising it again does.
Examples
Constructors
constructor
public
new
FlagDispatcher
():
FlagDispatcher
EventDispatcherBase.constructor
Properties
subscribable
readonly
public
subscribable
:
Subscribable
void
EventHandler
void
=
...
EventDispatcherBase.subscribable
Methods
clear
public
clear
():
void
Unsubscribe all subscribers from the event.
Inherited from
EventDispatcherBase.clear
isRaised
public
isRaised
():
boolean
Are subscribers being notified?
raise
public
raise
():
void
Notify all current and future subscribers.
reset
public
reset
():
void
Stop notifying future subscribers.
subscribe
public
override
subscribe
handler
:
EventHandler
void
: () =>
void
Subscribe to the event.
Parameters
-
handler : EventHandler voidThe handler to invoke when the event occurs.
EventDispatcherBase.subscribe
unsubscribe
public
unsubscribe
handler
:
EventHandler
void
:
void
Unsubscribe from the event.
Parameters
-
handler : EventHandler voidThe handler to unsubscribe.
EventDispatcherBase.unsubscribe