Type Alias: ContinuousUpdateContext<TState>
type ContinuousUpdateContext<TState> = {
delta_seconds: number;
since_seconds: number;
state: TState;
};
Defined in: livelink.clients/livelink.agent/sources/data/EventMapping.ts:55
What a ContinuousUpdate is handed every time it is sampled.
Type Parameters
| Type Parameter | Default type |
|---|---|
TState extends object | Record<string, never> |
Properties
delta_seconds
delta_seconds: number;
Defined in: livelink.clients/livelink.agent/sources/data/EventMapping.ts:64
Seconds since the previous sample, and 0 on the event that installs the continuation — so a
value integrated with it (state.x += rate * delta_seconds) never double-counts the install,
and never runs away as re-reading since_seconds would.
This is the one to reach for when a value accumulates; use since_seconds when it is a closed-form function of how long the motion has been running.
since_seconds
since_seconds: number;
Defined in: livelink.clients/livelink.agent/sources/data/EventMapping.ts:70
Seconds since this continuation was installed — since the event that set the rate. 0 on that
installing event.
state
state: TState;
Defined in: livelink.clients/livelink.agent/sources/data/EventMapping.ts:81
Scratch space belonging to the entity, not to this motion: it outlives the event that replaces the continuation, so a shaft told a new rpm carries on from the angle it had reached rather than snapping back to zero. It is dropped only when the entity is deleted.
This is what a mapping would otherwise keep in a Map of its own, with the phase read at event
time and written back on every tick — a pattern that is one misplaced read away from
accelerating forever.