A timer should measure time—not browser paint cycles.
Browsers may delay background JavaScript to save power. FocusHub treats those callbacks as display reminders, not as the clock itself. Every update derives elapsed time from a wall-clock timestamp, so the display catches up when the tab runs again.
How the countdown works
- Start
Record a real start time
When you press Start, FocusHub stores the current wall-clock time and the elapsed value already on the timer.
- Update
Derive elapsed time again
On every display update, elapsed time is recalculated from the current time minus the recorded start time. Missed callbacks do not need to be replayed.
- Recover
Reconcile from the saved timestamp
The main countdown saves running state in this browser. After an accidental refresh, it adds the real time spent away and caps an expired countdown at zero.
What the automated tests cover
These are deterministic checks of FocusHub’s timing math. They are not a laboratory calibration or a promise that every operating system will deliver an audible alert while asleep.
Scroll horizontally to compare each check
| Scenario | Test | Expected result |
|---|---|---|
| Delayed background callback | Advance wall-clock time by 45 seconds before the next display update. | A 2-minute countdown shows 1:15 remaining. |
| Pause immediately after returning | Pause after the same 45-second gap, before another timer paint. | The paused value still preserves all 45 elapsed seconds. |
| Refresh recovery | Restore a running 10-minute timer after 30 seconds away. | Elapsed time resumes at 2:10 when 1:40 had already elapsed. |
| Expired timer recovery | Restore a saved countdown after more time has passed than remained. | The value stops at zero instead of becoming negative. |
| Adjust while running | Add or subtract time after the countdown has started. | Elapsed time is preserved and the duration cannot move behind it. |
A two-minute background test
- Open the countdown timer and set 2:00.
- Press Start, then work in another tab for about 45 seconds.
- Return and confirm that the display reflects real elapsed time rather than only the updates you watched.
- Refresh once while it runs to test local recovery.
What a web timer cannot guarantee
- An operating system may suspend a browser or silence audio during deep sleep or power-saving modes.
- Browser notification, sound, Picture-in-Picture, fullscreen, and wake-lock support vary by device.
- Changing the device clock during a run can affect wall-clock timing.
- FocusHub is not intended for medical, laboratory, emergency, or other safety-critical timing.
For an important finish alert, keep the device awake, preview the selected sound, and grant notifications where supported. See timer troubleshooting for device-specific checks.