Interface: Consumer<T>
Defined in: src/sdk/data/Consumer.ts:7
A consumer of events which optionally filters event data before passing the consumed events to handlers.
Type Parameters
| Type Parameter |
|---|
T |
Properties
isConsumer
readonlyisConsumer:true
Defined in: src/sdk/data/Consumer.ts:9
Flags this object as a Consumer.
Methods
atFrequency()
atFrequency(
frequency,immediateFirstPublish?):Consumer<T>
Defined in: src/sdk/data/Consumer.ts:25
Caps the event subscription to a specified frequency, in Hz.
Parameters
| Parameter | Type | Description |
|---|---|---|
frequency | number | The frequency, in Hz, to cap to. |
immediateFirstPublish? | boolean | Whether to fire once immediately before throttling. |
Returns
Consumer<T>
A new consumer with the applied frequency filter.
handle()
handle(
handler,paused?):Subscription
Defined in: src/sdk/data/Consumer.ts:17
Handles an event using the provided event handler.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | Handler<T> | The event handler for the event. |
paused? | boolean | Whether the new subscription should be initialized as paused. Defaults to false. |
Returns
A new subscription for the provided handler.
onlyAfter()
onlyAfter(
deltaTime):Consumer<T>
Defined in: src/sdk/data/Consumer.ts:54
Filters events by time such that events will not be consumed until a minimum duration has passed since the previous event.
Parameters
| Parameter | Type | Description |
|---|---|---|
deltaTime | number | The minimum delta time between events in milliseconds. |
Returns
Consumer<T>
A new consumer with the applied change threshold filter.
whenChanged()
whenChanged():
Consumer<T>
Defined in: src/sdk/data/Consumer.ts:46
Filter the subscription to consume only if the value has changed. At all. Really only useful for strings or other events that don't change much.
Returns
Consumer<T>
A new consumer with the applied change threshold filter.
whenChangedBy()
whenChangedBy(
amount):Consumer<T>
Defined in: src/sdk/data/Consumer.ts:39
Filter the subscription to consume only when the value has changed by a minimum amount.
Parameters
| Parameter | Type | Description |
|---|---|---|
amount | number | The minimum amount threshold below which the consumer will not consume. |
Returns
Consumer<T>
A new consumer with the applied change threshold filter.
withPrecision()
withPrecision(
precision):Consumer<T>
Defined in: src/sdk/data/Consumer.ts:32
Quantizes the numerical event data to consume only at the specified decimal precision.
Parameters
| Parameter | Type | Description |
|---|---|---|
precision | number | The decimal precision to snap to. |
Returns
Consumer<T>
A new consumer with the applied precision filter.