gatsby-image
Advanced tools
Comparing version 1.0.24 to 1.0.25
31
index.js
@@ -68,20 +68,25 @@ "use strict"; | ||
var listeners = []; | ||
if (typeof window !== "undefined" && window.IntersectionObserver) { | ||
io = new window.IntersectionObserver(function (entries) { | ||
entries.forEach(function (entry) { | ||
listeners.forEach(function (l) { | ||
if (l[0] === entry.target) { | ||
// Edge doesn't currently support isIntersecting, so also test for an intersectionRatio > 0 | ||
if (entry.isIntersecting || entry.intersectionRatio > 0) { | ||
io.unobserve(l[0]); | ||
l[1](); | ||
function getIO() { | ||
if (typeof io === "undefined" && typeof window !== "undefined" && window.IntersectionObserver) { | ||
io = new window.IntersectionObserver(function (entries) { | ||
entries.forEach(function (entry) { | ||
listeners.forEach(function (l) { | ||
if (l[0] === entry.target) { | ||
// Edge doesn't currently support isIntersecting, so also test for an intersectionRatio > 0 | ||
if (entry.isIntersecting || entry.intersectionRatio > 0) { | ||
io.unobserve(l[0]); | ||
l[1](); | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
}, { rootMargin: "200px" }); | ||
}, { rootMargin: "200px" }); | ||
} | ||
return io; | ||
} | ||
var listenToIntersections = function listenToIntersections(el, cb) { | ||
io.observe(el); | ||
getIO().observe(el); | ||
listeners.push([el, cb]); | ||
@@ -88,0 +93,0 @@ }; |
{ | ||
"name": "gatsby-image", | ||
"version": "1.0.24", | ||
"version": "1.0.25", | ||
"description": "Lazy-loading React image component with optional support for the blur-up effect.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
21949
341