1export default function AnimShot(classDef) { 2 return function(opts) { 3 classDef.call(this, opts); 4 5 let oldLeave; 6 let currentOptions = {}; 7 8 const oldShow = this.show; 9 this.show = async (comp, opts={}) => { 10 currentOptions = opts; 11 12 // perform leave animation from previous show call: 13 await invoke(oldLeave); 14 15 oldLeave = opts.onLeave; 16 await oldShow(() => comp, opts); 17 18 // perform enter animation: 19 await invoke(opts.onEnter); 20 21 }; 22 23 const oldAnswer = this.answer; 24 this.answer = async (...args) => { 25 await invoke(currentOptions.onAnswer ?? currentOptions.onLeave); 26 return await oldAnswer(...args); 27 }; 28 }; 29} 30 31function invoke(func) { 32 if (typeof func === "function") { 33 return func(); 34 } 35 return Promise.resolve(); 36}
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.