Intermediate recipes
Use these patterns when the timer coordinates with side effects or external app state.
Core lifecycle callbacks
- Once-only onEnd: run completion logic once per generation.
- Backend event stop: cancel a timer from a WebSocket, SSE event, or external subscription.
Schedules
- Polling schedule: run cadence callbacks while the timer is active.
- Autosave heartbeat: save drafts or ping presence on a cadence.
- Poll and cancel: stop early when backend state says the flow is closed.
Diagnostics
- Diagnostics: emit optional lifecycle and schedule events while investigating behavior.