-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from shinsenter/develop
Reduce delays between promises in promise chain
- Loading branch information
Showing
9 changed files
with
150 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@shinsenter/defer.js", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"description": "🥇 A super tiny, native performant library for lazy-loading JS, CSS, images, iframes... Defer almost anything, easily speed up your website. https://github.com/shinsenter/defer.js", | ||
"homepage": "https://github.com/shinsenter/defer.js#readme", | ||
"author": "Mai Nhut Tan <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,11 +39,11 @@ | |
|
||
<title>@shinsenter/defer.js - Easily lazy-load JS, CSS, images, iframes</title> | ||
|
||
<!-- <script src="../dist/defer_plus.min.js?v=1.1.13"></script> --> | ||
<!-- <script src="../dist/defer_plus.min.js?v=1.1.14"></script> --> | ||
<!-- <script type="deferjs">'IntersectionObserver'in window||deferscript('../dist/polyfill.min.js', 'polyfill-js', 1)</script> --> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].13/dist/defer_plus.min.js"></script> | ||
<script type="deferjs">'IntersectionObserver'in window||deferscript('https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].13/dist/polyfill.min.js', 'polyfill-js', 1)</script> | ||
<script src="https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].14/dist/defer_plus.min.js"></script> | ||
<script type="deferjs">'IntersectionObserver'in window||deferscript('https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].14/dist/polyfill.min.js', 'polyfill-js', 1)</script> | ||
|
||
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> | ||
<meta name="mobile-web-app-capable" content="yes"> | ||
|
@@ -304,7 +304,7 @@ | |
gtag('config', 'UA-34520609-2'); | ||
</script> | ||
|
||
<script type="deferjs"> | ||
<script> | ||
// lazy-load Google Tag Manager and social button scripts | ||
if (/^http/.test(window.location.protocol)) { | ||
deferscript('https://www.googletagmanager.com/gtag/js?id=UA-34520609-2', 'google-tag', 1000); | ||
|
@@ -349,10 +349,10 @@ <h2 id="getting-started">Getting started</h2> | |
<br /> | ||
<pre class="notranslate"><code>Code:</code><code class="highlight html"><head> | ||
<title>My awesome page</title> | ||
<script src="https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].13/dist/defer_plus.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].14/dist/defer_plus.min.js"></script> | ||
|
||
<!-- You may want to add small polyfill for IE 9~11 --> | ||
<script>deferscript('https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].13/dist/polyfill.min.js', 'polyfill-js', 1)</script> | ||
<script>deferscript('https://cdn.jsdelivr.net/npm/@shinsenter/[email protected].14/dist/polyfill.min.js', 'polyfill-js', 1)</script> | ||
</head></code></pre> | ||
<p>Because the <a href="https://github.com/shinsenter/defer.js/blob/master/defer_plus.min.js" target="_blank" title="minified version of defer.js">minified version</a> of defer.js is super | ||
tiny, you can inline its content directly into the | ||
|
@@ -693,41 +693,39 @@ <h2>Follow the project on Github</h2> | |
<p>From <span class="big" title="Vietnam">🇻🇳</span> with love.</p> | ||
</div> | ||
|
||
<script type="deferjs"> | ||
<script> | ||
// Defer Test | ||
window.console = window.console || {} | ||
window.console.info = window.console.info || Function(); | ||
var tracker = []; | ||
defer(function () { | ||
window.console = window.console || {} | ||
window.console.info = window.console.info || Function(); | ||
var tracker = []; | ||
defer(function () { | ||
tracker.push(1), console.info('defer.js test #1 (throws an exception: foo is not defined)'), foo.push(bar) | ||
}, 200); | ||
defer(function () { | ||
tracker.push(2), console.info('defer.js test #2 (even though an exception has been thrown)') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(3), console.info('defer.js test #3') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(4), console.info('defer.js test #4') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(5), console.info('defer.js test #5') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(0), console.info('defer.js test #0 (the latest call, but has lower delay time)') | ||
}, 199); | ||
defer(function () { | ||
console.info('Completed! ' + (tracker == '0,1,2,3,4,5' ? 'Test passed!!!' : 'Test failed. ' + tracker)) | ||
}, 201); | ||
}); | ||
tracker.push(1), console.info('defer.js test #1 (throws an exception: foo is not defined)'), bar() | ||
}, 200); | ||
defer(function () { | ||
tracker.push(2), console.info('defer.js test #2 (even though an exception has been thrown)') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(3), console.info('defer.js test #3') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(4), console.info('defer.js test #4') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(5), console.info('defer.js test #5') | ||
}, 200); | ||
defer(function () { | ||
tracker.push(0), console.info('defer.js test #0 (the latest call, but has lower delay time)') | ||
}, 199); | ||
defer(function () { | ||
console.info('Completed! ' + (tracker == '0,1,2,3,4,5' ? 'Test passed!!!' : 'Test failed. ' + tracker)) | ||
}, 201); | ||
</script> | ||
|
||
<script type="deferjs">console.log('deferjs script tags test 1');</script> | ||
<script type="deferjs">console.log('deferjs script tags test 2');</script> | ||
<script type="deferjs">console.log('deferjs script tags test 3');</script> | ||
<script type="deferjs">console.log('deferjs script tags test 4');</script> | ||
<script type="deferjs">console.log('deferjs script tags test 5');</script> | ||
<script type="deferjs">console.log('deferjs script tags test 1')</script> | ||
<script type="deferjs">console.log('deferjs script tags test 2 with exception'),foo()</script> | ||
<script type="deferjs">console.log('deferjs script tags test 3 runs after the exception')</script> | ||
<script type="deferjs">console.log('deferjs script tags test 4')</script> | ||
<script type="deferjs">console.log('deferjs script tags test 5')</script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.