Skip to main content

Class: ConsumerValue<T>

Defined in: src/sdk/data/ConsumerValue.ts:13

Captures the state of a value from a consumer.

Type Parameters

Type Parameter
T

Implements

Properties

canInitialNotify

readonly canInitialNotify: true = true

Defined in: src/sdk/data/ConsumerValue.ts:15

Whether this subscription supports initial notifications on resume.

Implementation of

Subscription.canInitialNotify

Accessors

isAlive

Get Signature

get isAlive(): boolean

Defined in: src/sdk/data/ConsumerValue.ts:31

Whether this object is alive. While alive, this object will update its value from its event consumer unless it is paused. Once dead, this object will no longer update its value and cannot be resumed again.

Returns

boolean

Whether this subscription is alive. Live subscriptions can be freely paused and resumed. Dead subscriptions no longer receive notifications from their sources and will throw an error when attempting to pause or resume them.

Implementation of

Subscription.isAlive


isPaused

Get Signature

get isPaused(): boolean

Defined in: src/sdk/data/ConsumerValue.ts:40

Whether event consumption is currently paused. While paused, this object's value will not update.

Returns

boolean

Whether this subscription is paused. Paused subscriptions do not receive notifications from their sources until they are resumed.

Implementation of

Subscription.isPaused

Methods

destroy()

destroy(): void

Defined in: src/sdk/data/ConsumerValue.ts:181

Destroys this object. Once destroyed, it will no longer consume events to update its value.

Returns

void

Implementation of

Subscription.destroy


get()

get(): T

Defined in: src/sdk/data/ConsumerValue.ts:68

Gets this item's state.

Returns

T

This item's state.

Implementation of

Accessible.get


pause()

pause(): this

Defined in: src/sdk/data/ConsumerValue.ts:142

Pauses consuming events for this object. Once paused, this object's value will not be updated.

Returns

this

This object, after it has been paused.

Implementation of

Subscription.pause


reset()

reset(initialVal, consumer): this

Defined in: src/sdk/data/ConsumerValue.ts:128

Resets this subject to an initial value and optionally sets a new consumer from which this subject will derive its value. If the consumer is null, then this object's value will not be updated until a non-null consumer is set.

Parameters

ParameterTypeDefault valueDescription
initialValTundefinedThe initial value to which to reset this object.
consumernull | Consumer<T>nullAn event consumer. Defaults to null.

Returns

this

This object, after it has been reset.


resume()

resume(): this

Defined in: src/sdk/data/ConsumerValue.ts:161

Resumes consuming events for this object. Once resumed, this object's value will be updated from consumed events.

Any initialNotify argument passed to this method is ignored. This object is always immediately notified of its event consumer's value when resumed.

Returns

this

This object, after it has been resumed.

Implementation of

Subscription.resume


setConsumer()

setConsumer(consumer): this

Defined in: src/sdk/data/ConsumerValue.ts:78

Sets the consumer from which this object derives its value. If the consumer is null, this object's value will not be updated until a non-null consumer is set.

Parameters

ParameterTypeDescription
consumernull | Consumer<T>An event consumer.

Returns

this

This object, after its consumer has been set.


setConsumerWithDefault()

setConsumerWithDefault(consumer, defaultVal): this

Defined in: src/sdk/data/ConsumerValue.ts:101

Sets the consumer from which this object derives its value and designates a default value to set if an event is not immediately consumed from the new consumer when this object is resumed. If the consumer is null, then this object's value will be set to the default value.

Parameters

ParameterTypeDescription
consumernull | Consumer<T>An event consumer.
defaultValTThe default value to set if the new consumer is null or if an event is not immediately consumed from the new consumer when this object is resumed.

Returns

this

This object, after its consumer has been set.


create()

static create<T>(consumer, initialValue): ConsumerValue<T>

Defined in: src/sdk/data/ConsumerValue.ts:192

Creates a new ConsumerValue.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
consumernull | Consumer<T>The consumer to track.
initialValueTThe initial value.

Returns

ConsumerValue<T>

The created ConsumerValue.