Skip to content

Fix DSU timer freeze on tab switch and refactor assets (externalize CSS/JS)#1

Open
raissanjay wants to merge 2 commits into
cmiqueo:mainfrom
raissanjay:timer-issue
Open

Fix DSU timer freeze on tab switch and refactor assets (externalize CSS/JS)#1
raissanjay wants to merge 2 commits into
cmiqueo:mainfrom
raissanjay:timer-issue

Conversation

@raissanjay
Copy link
Copy Markdown

Background / Issue

When switching browser tabs, JavaScript's setInterval can be throttled or paused, causing our DSU "Meeting Time" and per-speaker timers to stop counting until you return.

In addition, all of our CSS and JS was inlined in index.html, making it hard to maintain.

What this PR does

  1. Fixes the timer freeze

    • Rewrites every timer to calculate elapsed time via Date.now() - startTimestamp on each tick, rather than simply doing counter++.
    • This ensures that, even if the browser pauses intervals in background tabs, the next tick "jumps" the display forward to the correct elapsed time.
  2. Externalizes assets

    • Moves all CSS out of the <head> into dsu/style.css (pretty-printed & organized).
    • Moves all JS out of the inline <script> into dsu/script.js, with clear function boundaries and comments.
    • Updates dsu/index.html to be a clean, well-indented template that simply links to style.css and script.js.
  3. Keeps behavior identical

    • Styling and layout unchanged.
    • Speaker‐selection logic, click handlers, and "Done! / Reset" flows remain the same, with the added robustness of our new timing approach.

How to test

  1. Open dsu/index.html in a browser.
  2. Click "Start Meeting" → select a few speakers.
  3. Switch to another tab for 10–15 seconds, then return.
    • Both the main meeting timer and any active speaker timer should have "caught up" correctly.
  4. Walk through "Next Speaker" → "End Meeting" → "Reset Meeting" to verify no regressions.

Please let me know if you spot any edge cases or styling tweaks—otherwise this is ready to merge!

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.

2 participants