UpdateCoordinator
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:46
Coordinates update batching, coalescing, and flush scheduling.
Updates are queued and debounced for efficiency. Before flushing, updates are coalesced:
- Only the latest
chart_resizeis kept vessel_mutationupdates for the same instance are combined
User intents bypass the coordinator entirely and are handled
directly by the Orchestrator via processIntent.
Example
Section titled “Example”const coordinator = new UpdateCoordinator({ debounceDelayMs: 300 });
coordinator.events.on('updates_flushed', (event) => { buildAndSendRequest(event.updates);});
coordinator.schedule({ type: 'chart_resize', width: 800, height: 600 });Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new UpdateCoordinator(
options?):UpdateCoordinator
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:56
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”UpdateCoordinator
Properties
Section titled “Properties”events
Section titled “events”
readonlyevents:EventSubscriber<UpdateCoordinatorEvents>
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:48
Accessors
Section titled “Accessors”pendingCount
Section titled “pendingCount”Get Signature
Section titled “Get Signature”get pendingCount():
number
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:155
Returns
Section titled “Returns”number
Methods
Section titled “Methods”clear()
Section titled “clear()”clear():
void
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:159
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:168
Returns
Section titled “Returns”void
flush()
Section titled “flush()”flush():
UpdateReason[]
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:98
Synchronously flushes all pending updates.
Coalesces updates, clears the queue, emits updates_flushed,
and returns the coalesced updates.
Returns
Section titled “Returns”UpdateReason[]
getPending()
Section titled “getPending()”getPending():
UpdateReason[]
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:147
Returns
Section titled “Returns”UpdateReason[]
hasPending()
Section titled “hasPending()”hasPending():
boolean
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:151
Returns
Section titled “Returns”boolean
schedule()
Section titled “schedule()”schedule(
reason):void
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:66
Queues an update reason for the next debounced flush.
No-op after disposal.
Parameters
Section titled “Parameters”reason
Section titled “reason”UpdateReason
Returns
Section titled “Returns”void
takeCoalesced()
Section titled “takeCoalesced()”takeCoalesced():
UpdateReason[]
Defined in: packages/client/src/lib/update-coordination/update-coordinator.ts:129
Takes all pending updates (coalesced) without emitting events.
Useful for the processIntent path where the orchestrator
handles request assembly directly.
Returns
Section titled “Returns”UpdateReason[]