1 line
No EOL
1.8 KiB
Text
1 line
No EOL
1.8 KiB
Text
{"version":3,"sources":["../../../src/directives/scroll/index.ts"],"names":[],"mappings":"AASA,SAAS,QAAT,CAAmB,EAAnB,EAAoC,OAApC,EAAiE;AAC/D,QAAM,QAAQ,GAAG,OAAO,CAAC,KAAzB;AACA,QAAM,OAAO,GAAG,OAAO,CAAC,OAAR,IAAmB;AAAE,IAAA,OAAO,EAAE;AAAX,GAAnC;AACA,QAAM,MAAM,GAAG,OAAO,CAAC,GAAR,GAAc,QAAQ,CAAC,aAAT,CAAuB,OAAO,CAAC,GAA/B,CAAd,GAAoD,MAAnE;AACA,MAAI,CAAC,MAAL,EAAa;AAEb,EAAA,MAAM,CAAC,gBAAP,CAAwB,QAAxB,EAAkC,QAAlC,EAA4C,OAA5C;AAEA,EAAA,EAAE,CAAC,SAAH,GAAe;AACb,IAAA,QADa;AAEb,IAAA,OAFa;AAGb,IAAA;AAHa,GAAf;AAKD;;AAED,SAAS,MAAT,CAAiB,EAAjB,EAAgC;AAC9B,MAAI,CAAC,EAAE,CAAC,SAAR,EAAmB;AAEnB,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,OAAZ;AAAqB,IAAA;AAArB,MAAgC,EAAE,CAAC,SAAzC;AAEA,EAAA,MAAM,CAAC,mBAAP,CAA2B,QAA3B,EAAqC,QAArC,EAA+C,OAA/C;AACA,SAAO,EAAE,CAAC,SAAV;AACD;;AAED,OAAO,MAAM,MAAM,GAAG;AACpB,EAAA,QADoB;AAEpB,EAAA;AAFoB,CAAf;AAKP,eAAe,MAAf","sourcesContent":["import { VNodeDirective } from 'vue/types/vnode'\nimport { DirectiveOptions } from 'vue'\n\ninterface ScrollVNodeDirective extends VNodeDirective {\n arg: string\n value: EventListenerOrEventListenerObject\n options?: boolean | AddEventListenerOptions\n}\n\nfunction inserted (el: HTMLElement, binding: ScrollVNodeDirective) {\n const callback = binding.value\n const options = binding.options || { passive: true }\n const target = binding.arg ? document.querySelector(binding.arg) : window\n if (!target) return\n\n target.addEventListener('scroll', callback, options)\n\n el._onScroll = {\n callback,\n options,\n target,\n }\n}\n\nfunction unbind (el: HTMLElement) {\n if (!el._onScroll) return\n\n const { callback, options, target } = el._onScroll\n\n target.removeEventListener('scroll', callback, options)\n delete el._onScroll\n}\n\nexport const Scroll = {\n inserted,\n unbind,\n} as DirectiveOptions\n\nexport default Scroll\n"],"sourceRoot":"","file":"index.js"} |