Skip to main content

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
Inherited from EventDispatcherBase.constructor

Properties

subscribable

readonly public subscribable: SubscribablevoidEventHandlervoid = ...
Inherited from 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 subscribehandler: EventHandlervoid: () => void

Subscribe to the event.

Parameters

Overwrites EventDispatcherBase.subscribe

unsubscribe

public unsubscribehandler: EventHandlervoid: void

Unsubscribe from the event.

Parameters

Inherited from EventDispatcherBase.unsubscribe