From f1d38931e2c09eb73cf47e23e09b95b0182296dd Mon Sep 17 00:00:00 2001 From: mikael-lovqvists-claude-agent Date: Sun, 22 Mar 2026 00:02:01 +0000 Subject: [PATCH] Plan: require class encapsulation for stateful components Co-Authored-By: Claude Sonnet 4.6 --- plan.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plan.md b/plan.md index 4090e7b..a89025d 100644 --- a/plan.md +++ b/plan.md @@ -116,6 +116,15 @@ collisions with host app styles. The host can override via CSS custom properties ``` +## Code Structure + +All stateful components must be classes, not bare module-level variables. The +current `app.mjs` has scanner state (`running`, `last_decoded_text`, `fps`, +etc.) scattered as module globals — this needs to be encapsulated in +`Barcode_Scanner` before the library refactor proceeds. Module scope is only +for constants and exports. + + ## Lifecycle ```