Skip to main content

ValueDispatcher

class ValueDispatcherT extends EventDispatcherBaseT

Dispatches a SubscribableValueEvent

Changing the value stored by a value dispatcher will immediately notify all its subscribers.

Examples

Type Parameters

  • T

    The type of the value passed to subscribers.

Constructors

constructor

public override new ValueDispatcherTvalue: T: ValueDispatcherT

Type Parameters

Parameters

Overwrites EventDispatcherBase.constructor

Properties

subscribable

readonly public subscribable: SubscribableValueEventT = ...

Accessors

current

public set currentvalue: T: void
public get current(): T

Set the current value of this dispatcher.

Setting the value will immediately notify all subscribers.

Parameters

Methods

clear

public clear(): void

Unsubscribe all subscribers from the event.

Inherited from EventDispatcherBase.clear

subscribe

public override subscribehandler: EventHandlerTdispatchImmediately: boolean = true: () => void

Subscribe to the event.

Subscribing will immediately invoke the handler with the most recent value.

Parameters

Overwrites EventDispatcherBase.subscribe

unsubscribe

public unsubscribehandler: EventHandlerT: void

Unsubscribe from the event.

Parameters

Inherited from EventDispatcherBase.unsubscribe