You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-21Lines changed: 20 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,18 +15,17 @@
15
15
16
16
## Why this exists
17
17
18
-
Timer hooks look simple until real apps need pause/resume semantics, Strict Mode cleanup, async callbacks, polling that does not overlap, and lists with dozens of independent timers.
18
+
Timers get messy when a product needs pause and resume, countdowns tied to server time, async work, or a screen full of independent rows.
19
19
20
-
`@crup/react-timer-hook`starts with a ~1.2 kB timer core and lets your app compose the heavier pieces only when it needs them:
20
+
`@crup/react-timer-hook`keeps the default import small and lets you add only the pieces your screen needs:
21
21
22
22
- ⏱️ `useTimer()` from the root package for one lifecycle: stopwatch, countdown, clock, or custom flow.
23
-
- 🔋 Batteries are optional: schedules, timer groups, duration helpers, and diagnostics live in subpath imports.
23
+
- 🔋 Add-ons are opt-in: schedules, timer groups, duration helpers, and diagnostics live in subpath imports.
24
24
- 🧭 `useTimerGroup()` from `/group` for many keyed lifecycles with one shared scheduler.
25
-
- 📡 `useScheduledTimer()` from `/schedules` for polling, overdue timing context, and opt-in diagnostics.
26
-
- 🧩 `durationParts()` from `/duration` for display math without locale or timezone opinions.
27
-
- 🧼 No formatting, timezone, audio, retry, cache, or data-fetching policy baked in.
28
-
- 🧪 Built for rerenders, Strict Mode, async callbacks, cleanup, and many timers.
29
-
- 🤖 Agent-friendly docs through hosted `llms.txt`, `llms-full.txt`, and an optional MCP docs helper.
25
+
- 📡 `useScheduledTimer()` from `/schedules` for polling and timing context.
26
+
- 🧩 `durationParts()` from `/duration` for common display math.
27
+
- 🧪 Tested for React Strict Mode, rerenders, async callbacks, cleanup, and multi-timer screens.
28
+
- 🤖 AI-ready docs are available through hosted `llms.txt`, `llms-full.txt`, and an optional MCP docs helper.
30
29
31
30
## Install
32
31
@@ -49,7 +48,7 @@ import { useScheduledTimer } from '@crup/react-timer-hook/schedules';
49
48
Each recipe has a live playground and a focused code sample:
Copy file name to clipboardExpand all lines: docs-site/docs/api/types.mdx
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,17 +52,16 @@ type TimerSchedule = {
52
52
53
53
`scheduledAt` is the intended fire time. `firedAt` is when the browser actually ran the callback. `overdueCount` reports how many schedule windows were missed before this callback because the browser, tab, or previous work delayed execution.
54
54
55
-
## Debug
55
+
## Diagnostics
56
56
57
-
Debug is opt-in. The package does not emit logs by default.
57
+
Diagnostics are opt-in. The package does not emit logs by default.
`useScheduledTimer()` includes the lifecycle API from `useTimer()` plus schedule callbacks and opt-in debug events. It lives in a subpath so the root import stays small for clocks, stopwatches, and countdowns that do not need polling.
12
+
`useScheduledTimer()` includes the lifecycle API from `useTimer()` plus schedule callbacks and optional diagnostics. It lives in a subpath so the root import stays small for clocks, stopwatches, and countdowns that do not need polling.
0 commit comments