1/** 2 * @class AnalyticsQueue 3 * @description - A global deferral queue to handle analytics tracking calls that occur 4 * before the alloy library is loaded. 5 * @usage: 6 * 7 * // instantiating the queue (this is already done during loadPage() in scripts.js): 8 * window.analyticsQueue = new AnalyticsQueue(); 9 * 10 * // Queuing tracking calls: 11 * window.analyticsQueue.enqueue(() => analyticsTrackFormStart(form)); 12 * 13 * // Processing queue (already handled in the analytics library): 14 * window.analyticsQueue.processQueue(); 15 */ 16 17export default class AnalyticsQueue { 18 constructor() { 19 this.queue = []; 20 this.processing = false; 21 } 22 23 enqueue(trackingCall) { 24 this.queue.push(trackingCall); 25 if(window.analyticsLoaded){ 26 this.processQueue(); 27 } 28 } 29 30 async processQueue() { 31 if (this.processing) return; 32 this.processing = true; 33 34 while (this.queue.length > 0) { 35 const currentCall = this.queue.shift(); 36 try { 37 currentCall(); 38 } catch (error) { 39 // eslint-disable-next-line no-console 40 console.error("Error processing tracking call from queue:", error); 41 } 42 } 43 44 this.processing = false; 45 } 46}
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.