Toastflow
Playground
API

Events

Subscribe to Toastflow lifecycle events for analytics, debugging, and UI reactions, including duplicates, updates, and timer resets.

Toastflow emits lightweight events through subscribeEvents.

Event types are defined in packages/core/src/types.ts — look for ToastEvent and ToastEventKind.

Subscribe

const off = toast.subscribeEvents((event) => {
  console.log(event.kind, event.id);
});

Event Kinds

duplicate
ToastEventKind
show(...) found an existing match while preventDuplicates: true.
timer-reset
ToastEventKind
A visible toast timer was reset (update, or resume with pauseStrategy: "reset").
update
ToastEventKind
update(id, options) succeeded.

Each event is a { id, kind } object — id is the affected toast's ToastId.

Behavior Notes

Typical Uses

  • Trigger CSS bump or progress reset animations
  • Analytics and telemetry for notification flows
  • Debug queue and timer behavior during development
Copyright © 2026