diff --git a/.eslintrc.json b/.eslintrc.json index 3f36631..bf1e71d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,6 +20,6 @@ "no-useless-escape": "warn", "no-regex-spaces": "warn", "semi": ["error", "always"], - "eqeqeq": "warn" + "eqeqeq": ["warn", "smart"] } } diff --git a/assets/js/base.js b/assets/js/base.js index 397c58f..9778205 100644 --- a/assets/js/base.js +++ b/assets/js/base.js @@ -41,6 +41,16 @@ * 32. Drag & Drop Upload * 33. Intersection Observer * 34. Full Initialisation + * + * NOTE ON EMPTY CATCH BLOCKS: throughout this file, `try { ... } catch (_) {}` + * around localStorage/sessionStorage access (persisted tab/theme/column- + * visibility state, recent command-palette entries, etc.) and the terminal + * beep's AudioContext calls is intentional, not an oversight — these are + * best-effort UX affordances that must silently no-op rather than break the + * surrounding feature if storage is disabled/full (private browsing, quota) + * or audio is blocked (autoplay policy). Swallowing errors from arbitrary + * caller-supplied callbacks (e.g. viewport-change listeners) is handled + * separately with real logging, since those can hide genuine bugs. */ (function (global) { @@ -1398,7 +1408,7 @@ _vpCurrent = bp; if (bp !== prev) { const evt = { bp, w, h, prev }; - _vpListeners.forEach(cb => { try { cb(evt); } catch (_) {} }); + _vpListeners.forEach(cb => { try { cb(evt); } catch (e) { console.error('[lt.viewport] listener threw:', e); } }); bus.emit('viewport:change', evt); } }