Skip to content

Commit

Permalink
1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
optimalisatie committed Jul 9, 2019
1 parent 1aebcc3 commit 00a80f4
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
@@ -1,6 +1,6 @@
{
"name": "styletools/lazy",
"version": "1.0.2",
"version": "1.0.3",
"description": "A lightweight lazy loader based on `window.IntersectionObserver` with tiny fallback for old browsers.",
"keywords": ["lazy",
"images",
Expand Down
6 changes: 3 additions & 3 deletions dist/lazy+polyfill.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lazy-data-attr+polyfill.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/lazy-data-attr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lazy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@style.tools/lazy",
"version": "1.0.2",
"version": "1.0.3",
"description": "A lightweight lazy image and iframe loader based on `window.IntersectionObserver` with tiny fallback for old browsers.",
"author": {
"name": "info@style.tools",
Expand Down
12 changes: 7 additions & 5 deletions src/lazy-async-polyfill.js
Expand Up @@ -14,7 +14,7 @@ function LAZY_QUEUE(config,callback) {
// load polyfill
if (!intersectionObserver) {

var POLYFILL;
var POLYFILL, _lazy;
if (win.$lazypoly) {
POLYFILL = win.$lazypoly;
} else if (LAZY_SCRIPT) {
Expand All @@ -23,21 +23,23 @@ if (!intersectionObserver) {

if (POLYFILL) {

win.$lazy = LAZY_QUEUE;
// temporary reference
_lazy = $lazy;
win.$lazy = $lazy = LAZY_QUEUE;

// method to load polyfill
if (typeof POLYFILL === 'function') {
if (typeof POLYFILL == 'function') {
POLYFILL = POLYFILL();
}

// enable custom promise/callback
// @example window.$lazypoly = function() { return { then: function(callback) { /* ... */ } } };
((typeof POLYFILL !== 'string' && "then" in POLYFILL) ? POLYFILL : $async.js(POLYFILL)).then(function() {
((typeof POLYFILL != 'string' && "then" in POLYFILL) ? POLYFILL : $async.js(POLYFILL)).then(function() {

intersectionObserver = win[intersectionObserverStr];

// restore lazy handler
win.$lazy = $lazy;
win.$lazy = $lazy = _lazy;

// process queue
var item;
Expand Down
2 changes: 1 addition & 1 deletion src/lazy-data-attr.js
Expand Up @@ -22,7 +22,7 @@ if (LAZY_SCRIPT) {
var config;
for (var i = 0, l = CONFIG.length; i < l; i++) {
try {
config = JSON.parse(CONFIG);
config = JSON.parse(CONFIG[i]);
} catch (err) {config = false;};

if (config) {
Expand Down
2 changes: 2 additions & 0 deletions src/lazy.js
Expand Up @@ -117,6 +117,8 @@ function $lazy(config, callback) {
callback([asset]);
}
}

return assets;
};

// window.$lazy
Expand Down

0 comments on commit 00a80f4

Please sign in to comment.