Builds the manager around the consumer's sync function.
The sync to fire on each tick.
Sink for a rejected sync.
Auto-sync cadence; false or 0 disables it.
Clears the pending timeout on disposal, preventing leaked timers.
Cancels any pending auto-sync tick, planned or held. The quiet window survives it on purpose: it is a fact about the upstream (a write is still settling), not about the schedule, so a cadence change or a cycle that clears and re-plans still lands its next tick after the window.
Opens a hold: the planned tick is parked until every hold is released. Holds nest, one per mutation in flight.
Schedules the next tick when an interval is armed; the sync runs fire-and-forget so a rejection is logged, never propagated.
Closes a hold. When it was the last one, the parked tick is armed again — no earlier than its own deadline, and no earlier than the quiet period from now. A release with no hold open is ignored: it closes nothing, so it settles nothing either.
How long the upstream needs to settle the mutation.
Updates the cadence and reschedules from now.
New interval; false or 0 disables the timer.
Manages periodic auto-sync with a configurable interval. Drives the consuming clients' periodic registry refresh.
A tick never fires while a hold is open, and never before the quiet period the last release asked for: a mutation in flight would be read back stale by a refresh that overlaps it, and one just landed needs the upstream a moment to settle before a re-read means anything. Holds only DELAY the planned tick — they never advance it. Deadlines are kept on the monotonic clock (
performance.now()), as every window in this package is: a system-time jump must neither stretch nor collapse the cadence.