1function runWhenIdle(callback, priority = 'background', args = null) { 2 if ('scheduler' in window && 'postTask' in scheduler) { 3 scheduler.postTask(callback, { priority }); 4 } else if ('requestIdleCallback' in window) { 5 window.requestIdleCallback(() => { 6 callback(args); 7 }); 8 } else { 9 window.requestAnimationFrame(() => { 10 callback(args); 11 }); 12 } 13} 14 15export const scheduleTaskAfterLoad = (callback, priority, args = null) => { 16 window.addEventListener('load', () => { 17 runWhenIdle(() => { 18 callback(args); 19 }, priority, args); 20 }); 21}; 22 23export const scheduleTask = (callback, priority, args = null) => { 24 runWhenIdle(() => { 25 callback(args); 26 }, priority, args); 27};
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.