1// Performance marks for the debug-flagged data-load timing (#280). 2// 3// No-ops unless `localStorage.jrda_debug === '1'` (the #170 debug toggle), so 4// nothing here runs in production. Every call is wrapped in try/catch: the 5// Performance API and localStorage can throw in privacy modes or under a 6// storage policy, and a throw here must never break the data-load path these 7// marks wrap (fetchCoreData's fail-loud contract, #290). 8 9const enabled = (() => { 10 try { 11 return typeof localStorage !== 'undefined' 12 && localStorage.getItem('jrda_debug') === '1' 13 && typeof performance !== 'undefined' 14 && typeof performance.mark === 'function'; 15 } catch { 16 return false; 17 } 18})(); 19 20export const perfMark = (name) => { 21 if (!enabled) return; 22 try { 23 performance.mark(name); 24 } catch { 25 // Performance API unavailable or name invalid -- timing is best-effort. 26 } 27}; 28 29export const perfMeasure = (name, startMark, endMark) => { 30 if (!enabled) return; 31 try { 32 performance.measure(name, startMark, endMark); 33 } catch { 34 // A missing start/end mark throws; skip rather than break the caller. 35 } 36};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.