- Extract duplicated SimpleEventEmitter class into shared utility `js/utils/eventEmitter.js`.
- Refactor AuthService, NostrService, ModerationService, and PlaybackService to use the shared class.
- Fix CI failure "matches is not iterable" in `js/channelProfile.js` by making `collectChannelVideos` synchronous and adding Array.isArray guards.
- Apply the same fix to `dist/js/channelProfile.js`.
- Add unit tests for SimpleEventEmitter.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces legacy scroll listener with `IntersectionObserver` to eliminate layout thrashing.
- Updates `js/docsView.js` with `rootMargin: "-96px 0px -50% 0px"` and correct scroll-up logic.
- Synchronizes `dist/js/docsView.js` to match the source logic exactly.
- Updates benchmarks to use the same logic for verification.
- Updates lint scripts to exclude benchmarks.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces the O(N) getBoundingClientRect polling loop in the docs scroll spy with an IntersectionObserver. This eliminates potential layout thrashing and reduces main thread CPU usage during scrolling.
- Replaces `window.addEventListener("scroll")` with `IntersectionObserver`.
- Maintains active section state using `passedHeadings` set.
- Updates `setupScrollSpy` and `clearScrollSpy` to manage the observer.
- Preserves existing behavior where the active section is the last one that has passed the top offset (96px). Note: Activation now occurs when the header *fully* exits the top offset area, which is a minor behavior change (delayed by header height) but improves performance and stability.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces the scroll event listener and `getBoundingClientRect` polling with `IntersectionObserver` to eliminate layout thrashing and improve scrolling performance.
- Removes `window.onscroll` handler in `docsView.js`.
- Implements `IntersectionObserver` with `rootMargin` to track active headings.
- Retains initial one-time scan for correct state on load.
- Adds benchmark `benchmarks/docs_scroll_spy.html` and `benchmarks/docs_scroll_spy_bench.js`.
Benchmark results:
- Legacy: ~0.065ms/call (200 calls) -> Total ~13ms CPU (sync layout thrashing)
- Optimized: ~0.028ms/call (32 calls) -> Total ~0.9ms CPU
- 14x improvement in CPU time for scroll handler logic.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Removed force flag (!) from `/* /index.html 200` in `_redirects` to allow static assets to be served.
- Restored `scripts/build-dist.mjs` to properly clean `dist/`, build CSS, and copy assets.
- Updated `package.json` to use the new build script and serve `dist`.
- Updated `netlify.toml` to publish the `dist` directory.
- Updated `dist/` artifacts to match current source.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Restore `scripts/build-dist.mjs` to clean `dist/`, build CSS, and copy assets.
- Update `package.json` to use the new build script and serve `dist`.
- Update `netlify.toml` to publish the `dist` directory.
- Update `dist/` artifacts to match current source.
Co-authored-by: PR0M3TH3AN <[email protected]>