Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lozad

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lozad - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

16

dist/lozad.js

@@ -1,2 +0,2 @@

/*! lozad.js - v0.0.3 - 2017-09-08
/*! lozad.js - v1.0.0 - 2017-09-10
* https://github.com/ApoorvSaxena/lozad.js

@@ -51,7 +51,11 @@ * Copyright (c) 2017 Apoorv Saxena; Licensed MIT */

var observer = new IntersectionObserver(onIntersection(load), {
rootMargin: rootMargin,
threshold: threshold
});
var observer = void 0;
if (window.IntersectionObserver) {
observer = new IntersectionObserver(onIntersection(load), {
rootMargin: rootMargin,
threshold: threshold
});
}
return {

@@ -63,3 +67,3 @@ observe: function observe() {

if (!window.IntersectionObserver) {
if (!observer) {
elements.forEach(function (element) {

@@ -66,0 +70,0 @@ load(element);

@@ -1,4 +0,4 @@

/*! lozad.js - v0.0.3 - 2017-09-08
/*! lozad.js - v1.0.0 - 2017-09-10
* https://github.com/ApoorvSaxena/lozad.js
* Copyright (c) 2017 Apoorv Saxena; Licensed MIT */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict";function t(t){t.dataset.loaded=!0}var e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n={rootMargin:"0px",threshold:0,load:function(t){t.src=t.dataset.src}},o=function(t){return"true"===t.dataset.loaded},r=function(e){return function(n,o){n.forEach(function(n){n.intersectionRatio>0&&(o.unobserve(n.target),e(n.target),t(n.target))})}};return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".lozad",a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=e({},n,a),u=c.rootMargin,f=c.threshold,d=c.load,s=new IntersectionObserver(r(d),{rootMargin:u,threshold:f});return{observe:function(){var e=[].filter.call(document.querySelectorAll(i),function(t){return!o(t)});window.IntersectionObserver?e.forEach(function(t){s.observe(t)}):e.forEach(function(e){d(e),t(e)})}}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict";function t(t){t.dataset.loaded=!0}var e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n={rootMargin:"0px",threshold:0,load:function(t){t.src=t.dataset.src}},o=function(t){return"true"===t.dataset.loaded},r=function(e){return function(n,o){n.forEach(function(n){n.intersectionRatio>0&&(o.unobserve(n.target),e(n.target),t(n.target))})}};return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".lozad",a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=e({},n,a),u=c.rootMargin,f=c.threshold,d=c.load,s=void 0;return window.IntersectionObserver&&(s=new IntersectionObserver(r(d),{rootMargin:u,threshold:f})),{observe:function(){var e=[].filter.call(document.querySelectorAll(i),function(t){return!o(t)});s?e.forEach(function(t){s.observe(t)}):e.forEach(function(e){d(e),t(e)})}}}});

@@ -5,3 +5,3 @@ {

"description": "A light-weight JS library to lazy load any HTML element such as images, ads, videos etc.",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/ApoorvSaxena/lozad.js",

@@ -8,0 +8,0 @@ "scripts": {

@@ -27,7 +27,10 @@ const defaultConfig = {

const {rootMargin, threshold, load} = {...defaultConfig, ...options}
let observer;
const observer = new IntersectionObserver(onIntersection(load), {
rootMargin,
threshold
})
if (window.IntersectionObserver) {
observer = new IntersectionObserver(onIntersection(load), {
rootMargin,
threshold
});
}

@@ -39,3 +42,3 @@ return {

if (!window.IntersectionObserver) {
if (!observer) {
elements

@@ -42,0 +45,0 @@ .forEach(element => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc