1export default function DeferredShot(classDef) { 2 return function(opts) { 3 4 classDef.call(this, opts); 5 6 this.deferrals = []; 7 this.defer = (action) => { 8 this.deferrals.push(action); 9 }; 10 11 const oldFinalize = this.finalize; 12 this.finalize = async (...args) => { 13 let action; 14 // eslint-disable-next-line no-cond-assign 15 while (action = this.deferrals.pop()) { 16 await action(); 17 } 18 return await oldFinalize(...args); 19 }; 20 21 const oldOnReturn = this.onreturn; 22 this.onreturn = async (...args) => { 23 let action; 24 // eslint-disable-next-line no-cond-assign 25 while (action = this.deferrals.pop()) { 26 await action(); 27 } 28 return await oldOnReturn(...args); 29 }; 30 31 }; 32}
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.