Skip to content

Commit cc216c9

Browse files
committed
Refactor: Replace state-store.js with service-worker-auxiliary-state-store.js and update references
1 parent 6ec3456 commit cc216c9

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

code-notes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ This document summarizes the non-profile state centralization changes and how to
66

77
## Overview
88

9-
- Centralized non-profile state is handled by a new service-worker module: modules/state-store.js.
9+
- Centralized non-profile state is handled by a new service-worker module: modules/service-worker-auxiliary-state-store.js.
1010
- config.js remains the single messaging entry point and now delegates only non-profile handlers to StateStore.
1111
- Backward compatibility is preserved via dual-read (prefer new schema, fallback to legacy) and dual-write (mirror writes to legacy keys).
1212

1313
Profiles are explicitly excluded. Keys under currentProfile and profiles.* remain owned by their existing logic.
1414

1515
## New Module
1616

17-
1) modules/state-store.js
17+
1) modules/service-worker-auxiliary-state-store.js
1818
- Purpose: Encapsulate non-profile state (UI and module/global settings) with a stable API and event broadcasts.
1919
- Context: Imported and executed in the service worker. It exports StateStore.
2020
- Responsibilities:
@@ -161,7 +161,7 @@ The Inline Profile Selector module adds a dropdown menu directly in the button r
161161
### Implementation
162162
- UI settings in popup: ['modules/popup-page-modules-inlineSelector.js'](modules/popup-page-modules-inlineSelector.js)
163163
- DOM creation: ['buttons-init-and-render.js'](buttons-init-and-render.js) (createInlineProfileSelector function)
164-
- Storage: ['modules/state-store.js'](modules/state-store.js) (inlineProfileSelector key)
164+
- Storage: ['modules/service-worker-auxiliary-state-store.js'](modules/service-worker-auxiliary-state-store.js) (inlineProfileSelector key)
165165
- Global config loading: ['init.js'](init.js) (loads settings during initialization)
166166

167167
### Integration Points
@@ -192,7 +192,7 @@ Recommended checks:
192192
## File References
193193

194194
- Service worker: ['config.js'](config.js)
195-
- State: ['modules/state-store.js'](modules/state-store.js)
195+
- State: ['modules/service-worker-auxiliary-state-store.js'](modules/service-worker-auxiliary-state-store.js)
196196
- Styles: ['common-ui-elements/common-style.css'](common-ui-elements/common-style.css), ['common-ui-elements/dark-theme.css'](common-ui-elements/dark-theme.css)
197197
- HTML: ['popup.html'](popup.html), ['welcome.html'](welcome.html)
198198
- Inline Profile Selector: ['modules/popup-page-modules-inlineSelector.js'](modules/popup-page-modules-inlineSelector.js)

config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ Instructions for AI: do not remove comments! MUST NOT REMOVE COMMENTS. This one
66
Service worker responsibilities (current):
77
- Single entry point for extension messaging (onMessage) and lifecycle (install/activate).
88
- Owns profile storage and related handlers (getConfig/saveConfig/switchProfile/etc.).
9-
- Delegates non‑profile storage (theme, custom selectors, floating panel, cross‑chat) to modules/state-store.js.
9+
- Delegates non‑profile storage (theme, custom selectors, floating panel, cross‑chat) to modules/service-worker-auxiliary-state-store.js.
1010
- Opens the welcome page on fresh install and runs migration checks.
1111
*/
1212
'use strict';
1313
import './context-menu.js';
14-
import './modules/state-store.js'; // state-store module (non-profile state)
15-
import { StateStore } from './modules/state-store.js';
14+
import { StateStore } from './modules/service-worker-auxiliary-state-store.js'; // state-store module (non-profile state)
1615
// Dependencies: default-config.json
1716

1817
// Ensure the service worker is registered

modules/state-store.js renamed to modules/service-worker-auxiliary-state-store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// modules/state-store.js
1+
// modules/service-worker-auxiliary-state-store.js
22
// Version: 0.1 (non-profile state only)
33
// Instructions for AI: do not remove comments! MUST NOT REMOVE COMMENTS.
44
// This module centralizes non-profile state in the service worker context.

0 commit comments

Comments
 (0)