Skip to content

Commit 4bceaf4

Browse files
committed
refactor(jspsych): split recording.ts into a recording/ directory
The single-file `modules/recording.ts` had grown to ~1840 lines holding schema types, options, internal constants, pure helpers, the global prototype-patch coordination, and the `SessionRecorder` class itself. Split into focused siblings under `modules/recording/`: index.ts (32 LOC) — public re-exports types.ts (194 LOC) — schema types only, no runtime options.ts (51 LOC) — RecordSessionOptions + resolver constants.ts (69 LOC) — internal numeric/string constants + CanvasState helpers.ts (162 LOC) — pure utilities (computeDiffBbox, serializeJson, …) global-patches.ts (174 LOC) — Math.random / Canvas refcounted patches SessionRecorder.ts (1240 LOC) — the main class The split avoids a circular import between `SessionRecorder` and `global-patches` by giving the patch module a minimal `RecorderHooks` interface (`notifyCanvasDraw` + `recordRngCall`) that the concrete class structurally satisfies. The public API is unchanged: `import ... from "./modules/recording"` (or `from "jspsych"`) resolves to `index.ts` which re-exports everything that was exported from the monolith. Tests + JsPsych.ts needed no import-path changes. All 728 workspace tests pass; tsc clean.
1 parent 59c0663 commit 4bceaf4

7 files changed

Lines changed: 724 additions & 643 deletions

File tree

0 commit comments

Comments
 (0)