1import { autorun } from "../utils.js"; 2 3export default function ReactiveShot(classDef) { 4 return function(opts) { 5 classDef.call(this, opts); 6 7 let lastCancel = ()=>{}; 8 const oldShow = this.show; 9 10 this.show = (compFunc, opts={}) => { 11 if (typeof compFunc !== "function") { 12 throw new TypeError("1st arg to show must be a function"); 13 } 14 lastCancel(); 15 let rsp = null; 16 const cancel = autorun(() => { 17 const deps = opts.vars ?? []; 18 for (const dep of deps) dep(); // track dependencies explicitly (not always necessary) 19 rsp = oldShow(compFunc, opts); 20 }); 21 lastCancel = cancel; 22 this.defer(cancel); 23 return rsp; 24 }; 25 }; 26}
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.