Repository navigation
Play-time and real-time clocks with pause toggle - #24
Merged
Merged
Conversation
Play time adds the gap between ticks, drops gaps over 5 minutes and is saved in state version 2 (migrated from 1). Trackers ask for elapsed play/real time with a TimeMark. Decision 008. Closes #2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying lsos with
|
| Latest commit: |
4dd93c6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f646faac.lsos-2qs.pages.dev |
| Branch Preview URL: | https://claude-2-clocks.lsos-2qs.pages.dev |
… discards the tab Gaps over 5 minutes are no longer dropped silently: they are held and the user is asked whether they were playing. The last tick is saved, so a discarded and reloaded tab continues; a normal close still stops the clock. Ticks and saves on visibilitychange and freeze, and saveNow writes the current state directly. Decision 008 updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Play time now lasts one session and is not saved; trackers will get each counted stretch through onPlayTime and keep their own progress. LSOS opens paused; a Settings checkbox starts tracking on open instead. The saved clock section holds only that setting. Decisions 003 and 008 updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2
What it does
src/lib/clock.ts): starts at zero each time LSOS opens and is not saved. Trackers keep their own saved progress, so a total across sessions adds nothing.clock.trackOnOpen, saved) starts it running instead; its hint says loading screens then count too.TRACKING/PAUSED, session play time, the current time and a Start/Pause button.now - lastTick, never a tick count, so a hidden tab ticking once a minute (Chrome throttling, e.g. while a fullscreen game covers the browser) still counts every second.src/lib/clock.svelte.ts):onPlayTime(listener)hands each counted stretch of play time to trackers (every tick, on pause, on close, on a confirmed gap) so they add it to their saved progress.realElapsed(sinceMs, now)covers real-time cooldowns.visibilitychange,freeze) so trackers' progress survives a discarded tab.saveNowwrites the current state directly, because the save effect would run too late in a page that is closing.pagehidestops measuring, so time away from a back/forward-cached page isn't counted.clock: { trackOnOpen }. Version 1 data migrates tofalse(tested with a stored sample).Tests
Fake timestamps only: starting paused or tracking, normal run, throttled background tab, gap at and above the threshold, confirming and skipping long gaps, clock set back, pause/resume, leaving and returning to the page, a new session after a reload, the play time reported to trackers, plus
realElapsed,formatDuration, and the migration and validation. Also checked in headless Chromium: opens paused at 0:00:00 with the hint, Start begins tracking and hides the hint, the setting persists and makes a reload start tracking, the long-gap prompt counts the gap.Try by hand
npm run dev: LSOS opensPAUSEDwith the "press Start once loaded in" hint. Press Start and watch session play time count up.TRACKINGfrom 0.🤖 Generated with Claude Code