1export const EventEmitter = { 2 on(eventName, callback, options = {}) { 3 if (!this._events) this._events = {}; 4 if (!this._events[eventName]) this._events[eventName] = []; 5 this._events[eventName].push(callback); 6 7 // Handle replay functionality 8 if (options.replay && this._lastValues && this._lastValues[eventName] !== undefined) { 9 queueMicrotask(() => { callback(...this._lastValues[eventName]); }); 10 } 11 }, 12 13 off(eventName, callback) { 14 if (!this._events || !this._events[eventName]) return; 15 const index = this._events[eventName].indexOf(callback); 16 if (index > -1) { 17 this._events[eventName].splice(index, 1); 18 } 19 }, 20 21 _emit(eventName, ...data) { 22 // Store last value for replay functionality 23 if (!this._lastValues) this._lastValues = {}; 24 this._lastValues[eventName] = data; 25 26 if (!this._events || !this._events[eventName]) return; 27 this._events[eventName].forEach(callback => { 28 queueMicrotask(() => { callback(...data); }); 29 }); 30 }, 31};
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.