Skip to Content

@revideo/core


@revideo/core / events / ValueDispatcher

Class: ValueDispatcher<T>

Defined in: events/ValueDispatcher.ts:30 

Dispatches a SubscribableValueEvent

Remarks

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

Example

class Example { // expose the event to external classes public get onValueChanged { return this.value.subscribable; } // create a private dispatcher private value = new ValueDispatcher(0); private changingValueExample() { // changing the value will notify all subscribers. this.value.current = 7; } }

Extends

Type Parameters

T

T

The type of the value passed to subscribers.

Constructors

Constructor

new ValueDispatcher<T>(value): ValueDispatcher<T>

Defined in: events/ValueDispatcher.ts:57 

Parameters

value

T

The initial value.

Returns

ValueDispatcher<T>

Overrides

EventDispatcherBase.constructor

Properties

subscribable

readonly subscribable: SubscribableValueEvent<T>

Defined in: events/ValueDispatcher.ts:31 

Overrides

EventDispatcherBase.subscribable

Accessors

current

Get Signature

get current(): T

Defined in: events/ValueDispatcher.ts:37 

Get the most recent value of this dispatcher.

Returns

T

Set Signature

set current(value): void

Defined in: events/ValueDispatcher.ts:49 

Set the current value of this dispatcher.

Remarks

Setting the value will immediately notify all subscribers.

Parameters
value

T

The new value.

Returns

void

Methods

clear()

clear(): void

Defined in: events/EventDispatcherBase.ts:38 

Unsubscribe all subscribers from the event.

Returns

void

Inherited from

EventDispatcherBase.clear


notifySubscribers()

protected notifySubscribers(value): any[]

Defined in: events/EventDispatcherBase.ts:42 

Parameters

value

T

Returns

any[]

Inherited from

EventDispatcherBase.notifySubscribers


subscribe()

subscribe(handler, dispatchImmediately?): () => void

Defined in: events/ValueDispatcher.ts:64 

Subscribe to the event.

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

Parameters

handler

EventHandler<T>

The handler to invoke when the event occurs.

dispatchImmediately?

boolean = true

Whether the handler should be immediately invoked with the most recent value.

Returns

Callback function that cancels the subscription.

() => void

Overrides

EventDispatcherBase.subscribe


unsubscribe()

unsubscribe(handler): void

Defined in: events/EventDispatcherBase.ts:31 

Unsubscribe from the event.

Parameters

handler

EventHandler

The handler to unsubscribe.

Returns

void

Inherited from

EventDispatcherBase.unsubscribe

© 2026 Haven Technologies, Inc.
Class: ValueDispatcher<T> – Revideo