v-lazy-image
Advanced tools
Comparing version 1.3.0 to 1.3.1
/** | ||
* v-lazy-image v1.3.0 | ||
* v-lazy-image v1.3.1 | ||
* (c) 2019 Alex Jover Morales <alexjovermorales@gmail.com> | ||
@@ -77,11 +77,17 @@ * @license MIT | ||
this.observer = new IntersectionObserver(function (entries) { | ||
var image = entries[0]; | ||
if (image.isIntersecting) { | ||
this$1.intersected = true; | ||
this$1.observer.disconnect(); | ||
this$1.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
if ("IntersectionObserver" in window) { | ||
this.observer = new IntersectionObserver(function (entries) { | ||
var image = entries[0]; | ||
if (image.isIntersecting) { | ||
this$1.intersected = true; | ||
this$1.observer.disconnect(); | ||
this$1.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
} else { | ||
console.error( | ||
"v-lazy-image: this browser doesn't support IntersectionObserver. Please use this polyfill to make it work https://github.com/w3c/IntersectionObserver/tree/master/polyfill." | ||
); | ||
} | ||
}, | ||
@@ -88,0 +94,0 @@ destroyed: function destroyed() { |
/** | ||
* v-lazy-image v1.3.0 | ||
* v-lazy-image v1.3.1 | ||
* (c) 2019 Alex Jover Morales <alexjovermorales@gmail.com> | ||
@@ -73,11 +73,17 @@ * @license MIT | ||
this.observer = new IntersectionObserver(function (entries) { | ||
var image = entries[0]; | ||
if (image.isIntersecting) { | ||
this$1.intersected = true; | ||
this$1.observer.disconnect(); | ||
this$1.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
if ("IntersectionObserver" in window) { | ||
this.observer = new IntersectionObserver(function (entries) { | ||
var image = entries[0]; | ||
if (image.isIntersecting) { | ||
this$1.intersected = true; | ||
this$1.observer.disconnect(); | ||
this$1.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
} else { | ||
console.error( | ||
"v-lazy-image: this browser doesn't support IntersectionObserver. Please use this polyfill to make it work https://github.com/w3c/IntersectionObserver/tree/master/polyfill." | ||
); | ||
} | ||
}, | ||
@@ -84,0 +90,0 @@ destroyed: function destroyed() { |
/** | ||
* v-lazy-image v1.3.0 | ||
* v-lazy-image v1.3.1 | ||
* (c) 2019 Alex Jover Morales <alexjovermorales@gmail.com> | ||
@@ -79,11 +79,17 @@ * @license MIT | ||
this.observer = new IntersectionObserver(function (entries) { | ||
var image = entries[0]; | ||
if (image.isIntersecting) { | ||
this$1.intersected = true; | ||
this$1.observer.disconnect(); | ||
this$1.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
if ("IntersectionObserver" in window) { | ||
this.observer = new IntersectionObserver(function (entries) { | ||
var image = entries[0]; | ||
if (image.isIntersecting) { | ||
this$1.intersected = true; | ||
this$1.observer.disconnect(); | ||
this$1.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
} else { | ||
console.error( | ||
"v-lazy-image: this browser doesn't support IntersectionObserver. Please use this polyfill to make it work https://github.com/w3c/IntersectionObserver/tree/master/polyfill." | ||
); | ||
} | ||
}, | ||
@@ -90,0 +96,0 @@ destroyed: function destroyed() { |
/** | ||
* v-lazy-image v1.3.0 | ||
* v-lazy-image v1.3.1 | ||
* (c) 2019 Alex Jover Morales <alexjovermorales@gmail.com> | ||
@@ -7,2 +7,2 @@ * @license MIT | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.VLazyImage={})}(this,function(e){"use strict";var t={props:{src:{type:String,required:!0},srcPlaceholder:{type:String,default:""},srcset:{type:String},intersectionOptions:{type:Object,default:function(){return{}}},usePicture:{type:Boolean,default:!1}},inheritAttrs:!1,data:function(){return{observer:null,intersected:!1,loaded:!1}},computed:{srcImage:function(){return this.intersected?this.src:this.srcPlaceholder},srcsetImage:function(){return!(!this.intersected||!this.srcset)&&this.srcset}},methods:{load:function(){this.$el.getAttribute("src")!==this.srcPlaceholder&&(this.loaded=!0,this.$emit("load"))}},render:function(e){var t=e("img",{attrs:{src:this.srcImage,srcset:this.srcsetImage},domProps:this.$attrs,class:{"v-lazy-image":!0,"v-lazy-image-loaded":this.loaded},on:{load:this.load}});return this.usePicture?e("picture",{on:{load:this.load}},[this.$slots.default,t]):t},mounted:function(){var e=this;this.observer=new IntersectionObserver(function(t){t[0].isIntersecting&&(e.intersected=!0,e.observer.disconnect(),e.$emit("intersect"))},this.intersectionOptions),this.observer.observe(this.$el)},destroyed:function(){this.observer.disconnect()}},s={install:function(e,s){e.component("VLazyImage",t)}};e.default=t,e.VLazyImagePlugin=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.VLazyImage={})}(this,function(e){"use strict";var t={props:{src:{type:String,required:!0},srcPlaceholder:{type:String,default:""},srcset:{type:String},intersectionOptions:{type:Object,default:function(){return{}}},usePicture:{type:Boolean,default:!1}},inheritAttrs:!1,data:function(){return{observer:null,intersected:!1,loaded:!1}},computed:{srcImage:function(){return this.intersected?this.src:this.srcPlaceholder},srcsetImage:function(){return!(!this.intersected||!this.srcset)&&this.srcset}},methods:{load:function(){this.$el.getAttribute("src")!==this.srcPlaceholder&&(this.loaded=!0,this.$emit("load"))}},render:function(e){var t=e("img",{attrs:{src:this.srcImage,srcset:this.srcsetImage},domProps:this.$attrs,class:{"v-lazy-image":!0,"v-lazy-image-loaded":this.loaded},on:{load:this.load}});return this.usePicture?e("picture",{on:{load:this.load}},[this.$slots.default,t]):t},mounted:function(){var e=this;"IntersectionObserver"in window?(this.observer=new IntersectionObserver(function(t){t[0].isIntersecting&&(e.intersected=!0,e.observer.disconnect(),e.$emit("intersect"))},this.intersectionOptions),this.observer.observe(this.$el)):console.error("v-lazy-image: this browser doesn't support IntersectionObserver. Please use this polyfill to make it work https://github.com/w3c/IntersectionObserver/tree/master/polyfill.")},destroyed:function(){this.observer.disconnect()}},s={install:function(e,s){e.component("VLazyImage",t)}};e.default=t,e.VLazyImagePlugin=s,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "v-lazy-image", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A Vue.js component to lazy load images using the Intersection Observer", | ||
@@ -5,0 +5,0 @@ "main": "dist/v-lazy-image.cjs.js", |
@@ -65,11 +65,17 @@ const VLazyImageComponent = { | ||
mounted() { | ||
this.observer = new IntersectionObserver(entries => { | ||
const image = entries[0]; | ||
if (image.isIntersecting) { | ||
this.intersected = true; | ||
this.observer.disconnect(); | ||
this.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
if ("IntersectionObserver" in window) { | ||
this.observer = new IntersectionObserver(entries => { | ||
const image = entries[0]; | ||
if (image.isIntersecting) { | ||
this.intersected = true; | ||
this.observer.disconnect(); | ||
this.$emit("intersect"); | ||
} | ||
}, this.intersectionOptions); | ||
this.observer.observe(this.$el); | ||
} else { | ||
console.error( | ||
"v-lazy-image: this browser doesn't support IntersectionObserver. Please use this polyfill to make it work https://github.com/w3c/IntersectionObserver/tree/master/polyfill." | ||
); | ||
} | ||
}, | ||
@@ -76,0 +82,0 @@ destroyed() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21695
445