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
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
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
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
get()
get():
T
Defined in: src/sdk/data/ConsumerValue.ts:68
Gets this item's state.
Returns
T
This item's state.
Implementation of
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
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
Parameter | Type | Default value | Description |
---|---|---|---|
initialVal | T | undefined | The initial value to which to reset this object. |
consumer | null | Consumer <T > | null | An 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
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
Parameter | Type | Description |
---|---|---|
consumer | null | 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
Parameter | Type | Description |
---|---|---|
consumer | null | Consumer <T > | An event consumer. |
defaultVal | T | The 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
Parameter | Type | Description |
---|---|---|
consumer | null | Consumer <T > | The consumer to track. |
initialValue | T | The initial value. |
Returns
ConsumerValue
<T
>
The created ConsumerValue.