1- var LazyComponent = ( function ( ) {
2- 'use strict' ;
1+ ( function ( global , factory ) {
2+ typeof exports === 'object' && typeof module !== 'undefined' ? module . exports = factory ( ) :
3+ typeof define === 'function' && define . amd ? define ( factory ) :
4+ ( global = typeof globalThis !== 'undefined' ? globalThis : global || self , global . LazyComponent = factory ( ) ) ;
5+ } ) ( this , ( function ( ) { 'use strict' ;
36
47 //
58 //
@@ -48,7 +51,7 @@ var LazyComponent = (function () {
4851 default : 0
4952 }
5053 } ,
51- data : function data ( ) {
54+ data ( ) {
5255 return {
5356 state : {
5457 wrapperTag : this . wrapperTag ,
@@ -61,18 +64,18 @@ var LazyComponent = (function () {
6164 } ;
6265 } ,
6366 watch : {
64- isIntersected : function isIntersected ( value ) {
67+ isIntersected ( value ) {
6568 if ( value ) {
6669 this . state . isIntersected = true ;
6770 }
6871 } ,
69- 'state.isIntersected' : function stateIsIntersected ( value ) {
72+ 'state.isIntersected' ( value ) {
7073 if ( value ) {
7174 this . $emit ( 'intersected' , this . $el ) ;
7275 }
7376 }
7477 } ,
75- mounted : function mounted ( ) {
78+ mounted ( ) {
7679 if ( this . isIntersectionObserverSupported ( ) ) {
7780 if ( ! this . state . isIntersected && ! this . state . idle ) {
7881 this . observe ( ) ;
@@ -84,36 +87,35 @@ var LazyComponent = (function () {
8487 this . $emit ( 'intersected' , this . $el ) ;
8588 }
8689 } ,
87- beforeDestroy : function beforeDestroy ( ) {
90+ beforeDestroy ( ) {
8891 if ( ! this . state . isIntersected && ! this . state . idle ) {
8992 this . unobserve ( ) ;
9093 }
9194 } ,
9295 methods : {
93- isIntersectionObserverSupported : function isIntersectionObserverSupported ( ) {
96+ isIntersectionObserverSupported ( ) {
9497 return 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window . IntersectionObserverEntry . prototype && 'isIntersecting' in window . IntersectionObserverEntry . prototype ;
9598 } ,
96- observe : function observe ( ) {
97- var _this$state = this . state ,
98- rootMargin = _this$state . rootMargin ,
99- threshold = _this$state . threshold ;
100- var config = {
99+ observe ( ) {
100+ const {
101+ rootMargin,
102+ threshold
103+ } = this . state ;
104+ const config = {
101105 root : undefined ,
102- rootMargin : rootMargin ,
103- threshold : threshold
106+ rootMargin,
107+ threshold
104108 } ;
105109 this . state . observer = new IntersectionObserver ( this . onIntersection , config ) ;
106110 this . state . observer . observe ( this . $el ) ;
107111 } ,
108- onIntersection : function onIntersection ( entries ) {
109- this . state . isIntersected = entries . some ( function ( entry ) {
110- return entry . intersectionRatio > 0 ;
111- } ) ;
112+ onIntersection ( entries ) {
113+ this . state . isIntersected = entries . some ( entry => entry . intersectionRatio > 0 ) ;
112114 if ( this . state . isIntersected ) {
113115 this . unobserve ( ) ;
114116 }
115117 } ,
116- unobserve : function unobserve ( ) {
118+ unobserve ( ) {
117119 if ( this . isIntersectionObserverSupported ( ) ) {
118120 this . state . observer . unobserve ( this . $el ) ;
119121 }
@@ -197,9 +199,9 @@ var LazyComponent = (function () {
197199 }
198200
199201 /* script */
200- var __vue_script__ = script ;
202+ const __vue_script__ = script ;
201203 /* template */
202- var __vue_render__ = function __vue_render__ ( ) {
204+ var __vue_render__ = function ( ) {
203205 var _vm = this ;
204206 var _h = _vm . $createElement ;
205207 var _c = _vm . _self . _c || _h ;
@@ -218,43 +220,43 @@ var LazyComponent = (function () {
218220 var __vue_staticRenderFns__ = [ ] ;
219221
220222 /* style */
221- var __vue_inject_styles__ = undefined ;
223+ const __vue_inject_styles__ = undefined ;
222224 /* scoped */
223- var __vue_scope_id__ = undefined ;
225+ const __vue_scope_id__ = undefined ;
224226 /* module identifier */
225- var __vue_module_identifier__ = undefined ;
227+ const __vue_module_identifier__ = undefined ;
226228 /* functional template */
227- var __vue_is_functional_template__ = false ;
229+ const __vue_is_functional_template__ = false ;
228230 /* style inject */
229231
230232 /* style inject SSR */
231233
232234 /* style inject shadow dom */
233235
234- var __vue_component__ = /*#__PURE__*/ normalizeComponent ( {
236+ const __vue_component__ = /*#__PURE__*/ normalizeComponent ( {
235237 render : __vue_render__ ,
236238 staticRenderFns : __vue_staticRenderFns__
237239 } , __vue_inject_styles__ , __vue_script__ , __vue_scope_id__ , __vue_is_functional_template__ , __vue_module_identifier__ , false , undefined , undefined , undefined ) ;
238240
239241 // Import vue component
240242
241243 // install function executed by Vue.use()
242- var install = function installLazyComponent ( Vue ) {
244+ const install = function installLazyComponent ( Vue ) {
243245 if ( install . installed ) return ;
244246 install . installed = true ;
245247 Vue . component ( 'LazyComponent' , __vue_component__ ) ;
246248 } ;
247249
248250 // Create module definition for Vue.use()
249- var plugin = {
250- install : install
251+ const plugin = {
252+ install
251253 } ;
252254
253255 // To auto-install on non-es builds, when vue is found
254256 // eslint-disable-next-line no-redeclare
255257 /* global window, global */
256258 {
257- var GlobalVue = null ;
259+ let GlobalVue = null ;
258260 if ( typeof window !== 'undefined' ) {
259261 GlobalVue = window . Vue ;
260262 } else if ( typeof global !== 'undefined' ) {
@@ -275,4 +277,4 @@ var LazyComponent = (function () {
275277
276278 return __vue_component__ ;
277279
278- } ) ( ) ;
280+ } ) ) ;
0 commit comments