1const TimedStorage = { 2 /** 3 * @param {string} key 4 * @param {any} value 5 * @param {number} ttlInSeconds 6 */ 7 set(key, value, ttlInSeconds = 86400) { 8 const expiry = Date.now() + ttlInSeconds * 1000; 9 const data = JSON.stringify({ value, expiry }); 10 localStorage.setItem(key, data); 11 }, 12 13 /** 14 * @param {string} key 15 * @returns {any|null} 16 */ 17 get(key) { 18 const raw = localStorage.getItem(key); 19 if (!raw) return null; 20 21 try { 22 const { value, expiry } = JSON.parse(raw); 23 if (Date.now() > expiry) { 24 localStorage.removeItem(key); 25 return null; 26 } 27 return value; 28 } catch { 29 localStorage.removeItem(key); 30 return null; 31 } 32 }, 33 34 /** 35 * @param {string} 36 */ 37 remove(key) { 38 localStorage.removeItem(key); 39 } 40};
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.