Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
verlok committed Mar 30, 2024
2 parents 342005a + 33c90c6 commit 6f25594
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 70 deletions.
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"ignore": ["node_modules/**"],
"plugins": ["@babel/plugin-transform-object-assign"],
"presets": [["@babel/env", { "modules": false }]],
"env": {
"test": {
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Version 19

#### 19.0.4

- Removed Babel plugin to polyfill `Object.assign()`, as suggested in #611.

#### 19.0.3

- Files `.eslintrc.json`, `LICENSE`, `CHANGELOG.md`, `CODE_OF_CONDUCT.md`, `README.md`, `package.json` are now included in the package
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ LazyLoad is a lightweight (2.4 kB) and flexible script that **speeds up your web
[![vanilla-lazyload (latest)](https://img.shields.io/npm/v/vanilla-lazyload/latest.svg)](https://www.npmjs.com/package/vanilla-lazyload)
[![vanilla-lazyload (downloads)](https://img.shields.io/npm/dy/vanilla-lazyload.svg)](https://www.npmjs.com/package/vanilla-lazyload)
[![](https://data.jsdelivr.com/v1/package/npm/vanilla-lazyload/badge)](https://www.jsdelivr.com/package/npm/vanilla-lazyload)
[![](https://github.com/verlok/vanilla-lazyload/actions/workflows/ci.yml/badge.svg)](https://github.com/verlok/vanilla-lazyload/actions/workflows/ci.yml)

➡️ Jump to: [👨‍💻 Getting started - HTML](#-getting-started---html) - [👩‍💻 Getting started - Script](#-getting-started---script) - [🥧 Recipes](#-recipes) - [📺 Demos](#-demos) - [😋 Tips & tricks](#-tips--tricks) - [🔌 API](#-api) - [😯 All features compared](#-all-features-compared)

Expand Down Expand Up @@ -175,17 +176,25 @@ Please note that the video poster can be lazily loaded too.

## 👩‍💻 Getting started - Script

The latest, recommended version of LazyLoad is **19.0.3**.
The latest, recommended version of LazyLoad is **19.0.4**.
Note that if you need to support Internet Explorer 11, you need to use version 17.9.0 or below.

Quickly understand how to upgrade from a previous version reading the [practical upgrade guide](UPGRADE.md).

### The simple, easiest way

The easiest way to use LazyLoad is to include the script from a CDN:
The easiest way to use LazyLoad is to include the script from a CDN.

```html
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.3/dist/lazyload.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.4/dist/lazyload.min.js"></script>
```

OR, if you prefer to import it as an ES module:

```html
<script type="module">
import LazyLoad from 'https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.3/+esm'
</script>
```

Then, in your javascript code:
Expand All @@ -196,7 +205,9 @@ var lazyLoadInstance = new LazyLoad({
});
```

To be sure that DOM for your lazy content is ready when you instantiate LazyLoad, **place the script tag right before the closing `</body>` tag**. If more DOM arrives later, e.g. via an AJAX call, you'll need to call `lazyLoadInstance.update();` to make LazyLoad check the DOM again.
To be sure that DOM for your lazy content is ready when you instantiate LazyLoad, **place the script tag right before the closing `</body>` tag**.

If more DOM arrives later, e.g. via an AJAX call, you'll need to call `lazyLoadInstance.update();` to make LazyLoad check the DOM again.

```js
lazyLoadInstance.update();
Expand Down Expand Up @@ -226,7 +237,7 @@ Then include the script.
```html
<script
async
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.3/dist/lazyload.min.js"
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.4/dist/lazyload.min.js"
></script>
```

Expand Down Expand Up @@ -260,7 +271,7 @@ Then include the script.
```html
<script
async
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.3/dist/lazyload.min.js"
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@19.0.4/dist/lazyload.min.js"
></script>
```

Expand Down
17 changes: 1 addition & 16 deletions dist/lazyload.iife.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
var LazyLoad = (function () {
'use strict';

function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}

var runningOnBrowser = typeof window !== "undefined";
var isBot = runningOnBrowser && !("onscroll" in window) || typeof navigator !== "undefined" && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
var isHiDpi = runningOnBrowser && window.devicePixelRatio > 1;
Expand Down Expand Up @@ -55,7 +40,7 @@ var LazyLoad = (function () {
restore_on_error: false
};
var getExtendedSettings = function getExtendedSettings(customSettings) {
return _extends({}, defaultSettings, customSettings);
return Object.assign({}, defaultSettings, customSettings);
};

/* Creates instance and notifies it through the window element */
Expand Down
2 changes: 1 addition & 1 deletion dist/lazyload.iife.min.js

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions dist/lazyload.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.LazyLoad = factory());
})(this, (function () { 'use strict';

function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}

var runningOnBrowser = typeof window !== "undefined";
var isBot = runningOnBrowser && !("onscroll" in window) || typeof navigator !== "undefined" && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
var isHiDpi = runningOnBrowser && window.devicePixelRatio > 1;
Expand Down Expand Up @@ -58,7 +43,7 @@
restore_on_error: false
};
var getExtendedSettings = function getExtendedSettings(customSettings) {
return _extends({}, defaultSettings, customSettings);
return Object.assign({}, defaultSettings, customSettings);
};

/* Creates instance and notifies it through the window element */
Expand Down
2 changes: 1 addition & 1 deletion dist/lazyload.min.js

Large diffs are not rendered by default.

29 changes: 2 additions & 27 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vanilla-lazyload",
"version": "19.0.3",
"version": "19.0.4",
"description": "LazyLoad is a lightweight (2.4 kB) and flexible script that speeds up your web application by deferring the loading of your below-the-fold images, videos and iframes to when they will enter the viewport. It's written in plain \"vanilla\" JavaScript, it leverages the IntersectionObserver API, it supports responsive images, it optimizes your website for slower connections, and can enable native lazy loading.",
"main": "dist/lazyload.min.js",
"module": "dist/esm/lazyload.js",
Expand All @@ -9,7 +9,6 @@
"sideEffects": false,
"devDependencies": {
"@babel/core": "^7.24.3",
"@babel/plugin-transform-object-assign": "^7.24.1",
"@babel/preset-env": "^7.24.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
Expand Down

0 comments on commit 6f25594

Please sign in to comment.