Skip to content

SelladuraiS/focus-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Focus Timer

A lightweight focus timer built with vanilla JavaScript, designed around a clear state machine with persistent session data.

Live Demo
👉 https://selladurais.github.io/focus-timer/


Why this project?

This project was built to demonstrate clean state management, predictable timer behavior, and data persistence without relying on frameworks.

The focus was correctness, edge-case handling, and maintainable logic rather than UI libraries.


Core Features

  • Deterministic Start / Pause / Resume flow
  • Configurable focus session duration
  • Distraction tracking per session
  • Persistent session history with timestamps
  • Derived statistics (total focus time, sessions, average distractions)
  • LocalStorage-based persistence
  • Dark / Light mode
  • Mobile-friendly layout

Technical Highlights

  • Explicit state machine for timer control
  • Defensive handling of pause/resume edge cases
  • Derived state calculated without mutating core logic
  • No framework abstractions — plain JavaScript only

Tech Stack

  • HTML5
  • CSS3 (CSS variables, dark mode)
  • Vanilla JavaScript

How to Run

  1. Clone or download the repository
  2. Open index.html in any modern browser
  3. No build tools or dependencies required

Version

v1.1 (Frozen)

This version is intentionally frozen after implementing derived session statistics without modifying the original state logic.

About

A minimal focus timer built with vanilla JavaScript using a clear state machine, persistence, and defensive logic.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors