Skip to content

feat: add background audio Pomodoro prototype - #9

Open
wenyanwu122-sudo wants to merge 1 commit into
AkongaLabs:mainfrom
wenyanwu122-sudo:pomodoro-background-audio-wenyan
Open

feat: add background audio Pomodoro prototype#9
wenyanwu122-sudo wants to merge 1 commit into
AkongaLabs:mainfrom
wenyanwu122-sudo:pomodoro-background-audio-wenyan

Conversation

@wenyanwu122-sudo

Copy link
Copy Markdown

Bounty Solution Submission

Problem Statement

This solves #1 by providing a minimal Pomodoro timer prototype that keeps accurate time while inactive and plays a Web Audio notification chime when the timer finishes, including when Chrome has backgrounded or minimized the tab.

Solution Approach

The solution is a dependency-free single HTML page. It uses a wall-clock deadline (Date.now()) for timer accuracy and schedules the alarm on the Web Audio clock immediately after the user presses Start, which is more reliable than waiting for a throttled background JavaScript timer. It also includes graceful status messaging for unsupported or blocked audio cases.

Technical Implementation

  • Package Manager: None. The bounty asks for a single HTML file with embedded CSS/JS and no external dependencies.
  • Database Setup: Not applicable.
  • Environment Variables: None.
  • Build Process: No build step. Open submissions/pomodoro-background-audio-wenyan/index.html directly or serve the repository with a static file server.

Testing Evidence

  • Test Coverage: Built-in deterministic self-test mode for time formatting and input validation.
  • Critical Flows Tested: first render, valid minute parsing, invalid inputs, MM:SS formatting, inactive-tab timer design, pause/resume behavior, audio unlock/scheduling path.
  • Test Results:
JS syntax OK
git diff --check: passed
npx --yes prettier --no-config --check submissions/pomodoro-background-audio-wenyan/index.html submissions/pomodoro-background-audio-wenyan/TESTING.md: passed
Self-test expected output is documented in TESTING.md and is available via index.html?selftest=1.

Demo Evidence

Choose ONE:

  • Video Demo: Local preview was verified in browser. The full manual background-audio test plan is included in submissions/pomodoro-background-audio-wenyan/TESTING.md.

Setup Instructions

Step-by-step instructions to run the code:

  1. Clone this branch.
  2. Open submissions/pomodoro-background-audio-wenyan/index.html in Chrome desktop.
  3. Optional: run python3 -m http.server 8080 from the repository root and open http://localhost:8080/submissions/pomodoro-background-audio-wenyan/index.html.
  4. For deterministic checks, open the page with ?selftest=1.

Database Setup

Not applicable.

Architectural Decisions

  • Web Audio is unlocked during the Start click and the alarm pattern is scheduled ahead of time on the audio clock to avoid relying on throttled background JavaScript timers.
  • Timer display is derived from a wall-clock deadline instead of interval counts, so inactive tabs catch up accurately.
  • Wake Lock is requested when available but remains optional.
  • The app remains a single HTML file with embedded CSS and JavaScript, as requested.

Bun/Yarn Justification

No package manager is used because there is no build or dependency step.


Pre-submission Checklist:

  • All bounty requirements met
  • Tests written and passing
  • Working demo available
  • Code is self-explanatory
  • Setup instructions complete
  • @adrianmurage tagged for review

I confirm this submission meets all requirements and is ready for review.

@adrianmurage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant