FlagDispatcher
class FlagDispatcher extends EventDispatcherBasevoid
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: SubscribablevoidEventHandlervoid = ...
EventDispatcherBase.subscribable
Methods
clear
public clear(): void
Unsubscribe all subscribers from the event.
Inherited fromEventDispatcherBase.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 subscribehandler: EventHandlervoid: () => void
Subscribe to the event.
Parameters
handler: EventHandlervoid
The handler to invoke when the event occurs.
EventDispatcherBase.subscribe
unsubscribe
public unsubscribehandler: EventHandlervoid: void
Unsubscribe from the event.
Parameters
handler: EventHandlervoid
The handler to unsubscribe.
EventDispatcherBase.unsubscribe