How swajanjain/focusshield works
Core Components
• Background Script: Represent background.js as the central orchestrator that handles events, timers (for daily resets), website monitoring, and enforcing limits.
• Options Page: Outline options.html, options.js, and options.css which form the settings page. This is where users set their website limits and configure customization settings.
• Blocked Content: Include blocked.html and blocked.css as the resources used to render the blocking screen when users exceed their limits.
• Additional Utility: Reference todo.js as a supplemental component—possibly a helper or additional feature—that might relate to task management or reminders.
Data Flow and Interactions
• Upon reaching a limit, the background script can trigger the Blocked Content view (blocked.html/blocked.css) to intercept further access.
• Auxiliary flows—such as the potential integration of “todo.js”—which might serve to enhance task management or provide future updates as mentioned in the README.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly delineate between background processes, UI components (Popup and Options pages), and content injection (Blocked view).
• Event-Driven Architecture: The background script handles events, triggered either by user actions or timers for resetting daily limits.
• Extensibility: The modular structure (separate JS and HTML/CSS files for different functionalities) allows for future features (e.g., accountability partners, Pomodoro timer, analytics dashboard) to be integrated seamlessly.