Skip to content

Releases: shinsenter/defer.js

3.9.0

03 Aug 20:12
e960298

Choose a tag to compare

  • The Defer.all() method now supports handling different type attribute values (such as <script type="module" />) (refer to the request in #148). Similar to how Defer.dom() works, you need to add an extra data-type attribute so that Defer.js can handle it properly for you.
  • Improve the content of the document.

Full Changelog: 3.8.0...3.9.0

3.8.0

02 Apr 02:29
1fb2132

Choose a tag to compare

What's Changed

Full Changelog: 3.7.0...3.8.0

3.7.0

07 Mar 04:43
b15612a

Choose a tag to compare

What's Changed

With this release, you can now add more attributes to the tags generated by the Defer.css or Defer.js methods.

For example:

This will load the animate.css library lazily.

<script>
  var origin = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1';

  Defer.css(origin + '/animate.min.css', {media: 'screen'}, 0, function () {
    console.info('Animate.css is loaded.'); // debug

    // adds animation classes to demo blocks.
    Defer.dom('.demo', 100, 'animate__animated animate__fadeIn');
  });
</script>

By adding {media: 'screen'}, the animate.css library will only load when the page is displayed on a screen-based device. The generated tag will look like:

<link media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet">

3.6.0

22 Mar 08:18
8a855b5

Choose a tag to compare

This is a temporary fix for the issue in the discussion #122.

In iOS Safari, the first click event may not work when using Defer.all() with the waitForUserAction argument set to true and one of deferred scripts make a DOM change.

3.5.0

21 Feb 07:08
151bf45

Choose a tag to compare

This version focuses on improving documentation and reducing the library file size after minification.
I would like to express warm thanks to @Ataruchi, @HeavyPeat and Limosuki for their articles in Japanese.

3.4.0

07 Sep 06:52
c23a444

Choose a tag to compare

chore(main): release 3.4.0 (chore: tag v3.4.0 (#119))

3.3.0

05 Sep 03:54
5af9819

Choose a tag to compare

chore(main): release 3.3.0 (chore: tag v3.3.0 (#118))

3.2.0

01 Sep 06:52
b81a41c

Choose a tag to compare

Added preload hints feature since v3.2.0 to prevent issues mentioned in the article Taming the Waterfall. This feature is as discussed in #112.

3.1.0

16 Aug 02:25
bdedf9c

Choose a tag to compare

Update documents and examples.

3.0.0

12 Aug 10:00
10ef3c9

Choose a tag to compare

Released defer.js v3.0.0

All examples and demo have been re-created.

New Defer.lazy variable and waitForInteraction argument were added since v3.0.

Setting Defer.lazy=true or waitForInteraction=true tells the library to delay the execution of deferred scripts until the user starts interacting with the page regardless of the page load event.

Changing the Defer.lazy variable will also affect the default behavior of these functions:

  • Defer()
  • Defer.all()
  • Defer.css()
  • Defer.js()