Skip to content

Refactor Chrome Extension to Modular Architecture #66

@ahelme

Description

@ahelme

Refactor Chrome Extension to Modular Architecture

Overview

Refactor panel.js (29K) and screenshot.js (44K) into modular, maintainable components following systematic plan.

Documentation

Phases

Phase 1: Shared Utilities (Low Risk)

  • Extract listener-pool.js
  • Extract retry-logic.js
  • Extract thread-safe-state.js
  • Update screenshot.js, navigation.js to use shared utilities

Phase 2: Screenshot Module (Medium Risk)

  • Extract filename-generator.js
  • Extract screenshot-capture.js
  • Extract screenshot-ui.js
  • Refactor screenshot-manager.js (44K → ~15K)

Phase 3: Panel Components (High Risk)

  • Extract settings-manager.js
  • Extract log-display.js
  • Extract ui-controller.js
  • Extract connection-manager.js
  • Refactor panel.js to orchestrator only (29K → ~10K)

Phase 4: ES6 Modules (Optional)

  • Convert to module system
  • Update manifest.json
  • Modern build setup

Success Criteria

  • File sizes reduced by 50%+
  • Code duplication eliminated
  • All features working as before
  • Memory leaks eliminated
  • Clear module boundaries

Implementation Timeline

  • Week 1: Shared utilities
  • Week 2: Screenshot module
  • Week 3: Panel components
  • Week 4: Integration & testing

Related Issues

Strategy

Build modular pieces one by one, test after each step, maintain backward compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions