1 |
- {"version":3,"sources":["../../src/directives/resize.ts"],"names":[],"mappings":";;;;;AAOA,SAAS,QAAT,CAAmB,EAAnB,EAAoC,OAApC,EAAiE;AAC/D,QAAM,WAAW,QAAQ,KAAzB;AACA,QAAM,UAAU,QAAQ,OAAR,IAAmB,EAAE,SAAS,IAAX,EAAnC;AAEA,WAAO,gBAAP,CAAwB,QAAxB,EAAkC,QAAlC,EAA4C,OAA5C;AACA,OAAG,SAAH,GAAe;AACb,0BADa;AAEb;AAFa,KAAf;AAKA,QAAI,CAAC,QAAQ,SAAT,IAAsB,CAAC,QAAQ,SAAR,CAAkB,KAA7C,EAAoD;AAClD;AACD;AACF;AAED,SAAS,MAAT,CAAiB,EAAjB,EAAgC;AAC9B,QAAI,CAAC,GAAG,SAAR,EAAmB;AADW,wBAGA,GAAG,SAHH;AAAA,QAGtB,QAHsB,iBAGtB,QAHsB;AAAA,QAGZ,OAHY,iBAGZ,OAHY;;AAI9B,WAAO,mBAAP,CAA2B,QAA3B,EAAqC,QAArC,EAA+C,OAA/C;AACA,WAAO,GAAG,SAAV;AACD;kBAEc;AACb,sBADa;AAEb;AAFa,C","sourcesContent":["import { VNodeDirective } from 'vue/types/vnode'\n\ninterface ResizeVNodeDirective extends VNodeDirective {\n value?: () => void\n options?: boolean | AddEventListenerOptions\n}\n\nfunction inserted (el: HTMLElement, binding: ResizeVNodeDirective) {\n const callback = binding.value!\n const options = binding.options || { passive: true }\n\n window.addEventListener('resize', callback, options)\n el._onResize = {\n callback,\n options\n }\n\n if (!binding.modifiers || !binding.modifiers.quiet) {\n callback()\n }\n}\n\nfunction unbind (el: HTMLElement) {\n if (!el._onResize) return\n\n const { callback, options } = el._onResize\n window.removeEventListener('resize', callback, options)\n delete el._onResize\n}\n\nexport default {\n inserted,\n unbind\n}\n"],"sourceRoot":""}
|