Comparing version 3.0.1 to 3.1.0
{ | ||
"name": "loadjs", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "authors": [ |
# LoadJS Changelog | ||
## 3.0.1 - December 9, 2016 | ||
## 3.1.0 - December 9, 2016 | ||
* Added numTries option | ||
* Added numRetries option | ||
@@ -7,0 +7,0 @@ ## 3.0.0 - August 25, 2016 |
@@ -86,3 +86,3 @@ loadjs = (function () { | ||
async = args.async, | ||
maxTries = args.numTries || 1, | ||
maxTries = (args.numRetries || 0) + 1, | ||
isCss, | ||
@@ -89,0 +89,0 @@ e; |
@@ -1,1 +0,1 @@ | ||
loadjs=function(){function n(n,e){n=n.push?n:[n];var t,r,o,i,c=[],f=n.length,h=f;for(t=function(n,t){t.length&&c.push(n),h--,h||e(c)};f--;)r=n[f],o=u[r],o?t(r,o):(i=s[r]=s[r]||[],i.push(t))}function e(n,e){if(n){var t=s[n];if(u[n]=e,t)for(;t.length;)t[0](n,e),t.splice(0,1)}}function t(n,e,r,o){var i,c,u=document,s=r.async,f=r.numTries||1;o=o||0,/\.css$/.test(n)?(i=!0,c=u.createElement("link"),c.rel="stylesheet",c.href=n):(c=u.createElement("script"),c.src=n,c.async=void 0===s||s),c.onload=c.onerror=c.onbeforeload=function(u){var s=u.type[0];if(i&&"hideFocus"in c)try{c.sheet.cssText.length||(s="e")}catch(n){s="e"}return"e"==s&&(o+=1,o<f)?t(n,e,r,o):void e(n,s,u.defaultPrevented)},u.head.appendChild(c)}function r(n,e,r){n=n.push?n:[n];var o,i,c=n.length,u=c,s=[];for(o=function(n,t,r){if("e"==t&&s.push(n),"b"==t){if(!r)return;s.push(n)}c--,c||e(s)},i=0;i<u;i++)t(n[i],o,r)}function o(n,t,o){var u,s;if(t&&t.trim&&(u=t),s=(u?o:t)||{},u){if(u in c)throw new Error("LoadJS");c[u]=!0}r(n,function(n){n.length?(s.error||i)(n):(s.success||i)(),e(u,n)},s)}var i=function(){},c={},u={},s={};return o.ready=function(e,t){return n(e,function(n){n.length?(t.error||i)(n):(t.success||i)()}),o},o.done=function(n){e(n,[])},o}(); | ||
loadjs=function(){function n(n,e){n=n.push?n:[n];var t,r,o,i,c=[],f=n.length,h=f;for(t=function(n,t){t.length&&c.push(n),h--,h||e(c)};f--;)r=n[f],o=u[r],o?t(r,o):(i=s[r]=s[r]||[],i.push(t))}function e(n,e){if(n){var t=s[n];if(u[n]=e,t)for(;t.length;)t[0](n,e),t.splice(0,1)}}function t(n,e,r,o){var i,c,u=document,s=r.async,f=(r.numRetries||0)+1;o=o||0,/\.css$/.test(n)?(i=!0,c=u.createElement("link"),c.rel="stylesheet",c.href=n):(c=u.createElement("script"),c.src=n,c.async=void 0===s||s),c.onload=c.onerror=c.onbeforeload=function(u){var s=u.type[0];if(i&&"hideFocus"in c)try{c.sheet.cssText.length||(s="e")}catch(n){s="e"}return"e"==s&&(o+=1,o<f)?t(n,e,r,o):void e(n,s,u.defaultPrevented)},u.head.appendChild(c)}function r(n,e,r){n=n.push?n:[n];var o,i,c=n.length,u=c,s=[];for(o=function(n,t,r){if("e"==t&&s.push(n),"b"==t){if(!r)return;s.push(n)}c--,c||e(s)},i=0;i<u;i++)t(n[i],o,r)}function o(n,t,o){var u,s;if(t&&t.trim&&(u=t),s=(u?o:t)||{},u){if(u in c)throw new Error("LoadJS");c[u]=!0}r(n,function(n){n.length?(s.error||i)(n):(s.success||i)(),e(u,n)},s)}var i=function(){},c={},u={},s={};return o.ready=function(e,t){return n(e,function(n){n.length?(t.error||i)(n):(t.success||i)()}),o},o.done=function(n){e(n,[])},o}(); |
@@ -94,3 +94,3 @@ (function(root, factory) { | ||
async = args.async, | ||
maxTries = args.numTries || 1, | ||
maxTries = (args.numRetries || 0) + 1, | ||
isCss, | ||
@@ -97,0 +97,0 @@ e; |
@@ -86,3 +86,3 @@ loadjs = (function () { | ||
async = args.async, | ||
maxTries = args.numTries || 1, | ||
maxTries = (args.numRetries || 0) + 1, | ||
isCss, | ||
@@ -89,0 +89,0 @@ e; |
@@ -1,1 +0,1 @@ | ||
loadjs=function(){function n(n,e){n=n.push?n:[n];var t,r,o,i,c=[],f=n.length,h=f;for(t=function(n,t){t.length&&c.push(n),h--,h||e(c)};f--;)r=n[f],o=u[r],o?t(r,o):(i=s[r]=s[r]||[],i.push(t))}function e(n,e){if(n){var t=s[n];if(u[n]=e,t)for(;t.length;)t[0](n,e),t.splice(0,1)}}function t(n,e,r,o){var i,c,u=document,s=r.async,f=r.numTries||1;o=o||0,/\.css$/.test(n)?(i=!0,c=u.createElement("link"),c.rel="stylesheet",c.href=n):(c=u.createElement("script"),c.src=n,c.async=void 0===s||s),c.onload=c.onerror=c.onbeforeload=function(u){var s=u.type[0];if(i&&"hideFocus"in c)try{c.sheet.cssText.length||(s="e")}catch(n){s="e"}return"e"==s&&(o+=1,o<f)?t(n,e,r,o):void e(n,s,u.defaultPrevented)},u.head.appendChild(c)}function r(n,e,r){n=n.push?n:[n];var o,i,c=n.length,u=c,s=[];for(o=function(n,t,r){if("e"==t&&s.push(n),"b"==t){if(!r)return;s.push(n)}c--,c||e(s)},i=0;i<u;i++)t(n[i],o,r)}function o(n,t,o){var u,s;if(t&&t.trim&&(u=t),s=(u?o:t)||{},u){if(u in c)throw new Error("LoadJS");c[u]=!0}r(n,function(n){n.length?(s.error||i)(n):(s.success||i)(),e(u,n)},s)}var i=function(){},c={},u={},s={};return o.ready=function(e,t){return n(e,function(n){n.length?(t.error||i)(n):(t.success||i)()}),o},o.done=function(n){e(n,[])},o}(); | ||
loadjs=function(){function n(n,e){n=n.push?n:[n];var t,r,o,i,c=[],f=n.length,h=f;for(t=function(n,t){t.length&&c.push(n),h--,h||e(c)};f--;)r=n[f],o=u[r],o?t(r,o):(i=s[r]=s[r]||[],i.push(t))}function e(n,e){if(n){var t=s[n];if(u[n]=e,t)for(;t.length;)t[0](n,e),t.splice(0,1)}}function t(n,e,r,o){var i,c,u=document,s=r.async,f=(r.numRetries||0)+1;o=o||0,/\.css$/.test(n)?(i=!0,c=u.createElement("link"),c.rel="stylesheet",c.href=n):(c=u.createElement("script"),c.src=n,c.async=void 0===s||s),c.onload=c.onerror=c.onbeforeload=function(u){var s=u.type[0];if(i&&"hideFocus"in c)try{c.sheet.cssText.length||(s="e")}catch(n){s="e"}return"e"==s&&(o+=1,o<f)?t(n,e,r,o):void e(n,s,u.defaultPrevented)},u.head.appendChild(c)}function r(n,e,r){n=n.push?n:[n];var o,i,c=n.length,u=c,s=[];for(o=function(n,t,r){if("e"==t&&s.push(n),"b"==t){if(!r)return;s.push(n)}c--,c||e(s)},i=0;i<u;i++)t(n[i],o,r)}function o(n,t,o){var u,s;if(t&&t.trim&&(u=t),s=(u?o:t)||{},u){if(u in c)throw new Error("LoadJS");c[u]=!0}r(n,function(n){n.length?(s.error||i)(n):(s.success||i)(),e(u,n)},s)}var i=function(){},c={},u={},s={};return o.ready=function(e,t){return n(e,function(n){n.length?(t.error||i)(n):(t.success||i)()}),o},o.done=function(n){e(n,[])},o}(); |
{ | ||
"name": "loadjs", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"license": "MIT", | ||
@@ -24,8 +24,8 @@ "description": "Tiny async loader for modern browsers", | ||
"gulp": "git+https://github.com/gulpjs/gulp#4.0", | ||
"gulp-jshint": "2.0.1", | ||
"gulp-jshint": "2.0.4", | ||
"gulp-rename": "1.2.2", | ||
"gulp-uglify": "2.0.0", | ||
"gulp-umd": "^0.2.0", | ||
"jshint": "^2.9.3" | ||
"jshint": "^2.9.4" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # LoadJS | ||
LoadJS is a tiny async loader for modern browsers (654 bytes). | ||
LoadJS is a tiny async loader for modern browsers (696 bytes). | ||
@@ -15,3 +15,3 @@ [![Dependency Status](https://david-dm.org/muicss/loadjs.svg)](https://david-dm.org/muicss/loadjs) | ||
LoadJS is based on the excellent <a href="https://github.com/ded/script.js">$script</a> library by <a href="https://github.com/ded">Dustin Diaz</a>. We kept the behavior of the library the same but we re-wrote the code from scratch to add support for success/error callbacks and to optimize the library for modern browsers. LoadJS is 654 bytes (minified + gzipped). | ||
LoadJS is based on the excellent <a href="https://github.com/ded/script.js">$script</a> library by <a href="https://github.com/ded">Dustin Diaz</a>. We kept the behavior of the library the same but we re-wrote the code from scratch to add support for success/error callbacks and to optimize the library for modern browsers. LoadJS is 696 bytes (minified + gzipped). | ||
@@ -121,3 +121,3 @@ Here's an example of what you can do with LoadJS: | ||
1. Try loading the files multiple times before calling the error callback | ||
1. Retry files before calling the error callback | ||
@@ -128,3 +128,3 @@ ```javascript | ||
error: function(pathsNotFound) { /* at least one path didn't load */ }, | ||
numTries: 3 | ||
numRetries: 3 | ||
}); | ||
@@ -131,0 +131,0 @@ ``` |
@@ -85,3 +85,3 @@ /** | ||
async = args.async, | ||
maxTries = args.numTries || 1, | ||
maxTries = (args.numRetries || 0) + 1, | ||
isCss, | ||
@@ -88,0 +88,0 @@ e; |
@@ -86,3 +86,3 @@ loadjs = (function () { | ||
async = args.async, | ||
maxTries = args.numTries || 1, | ||
maxTries = (args.numRetries || 0) + 1, | ||
isCss, | ||
@@ -89,0 +89,0 @@ e; |
@@ -1,1 +0,1 @@ | ||
loadjs=function(){function n(n,e){n=n.push?n:[n];var t,r,o,i,c=[],f=n.length,h=f;for(t=function(n,t){t.length&&c.push(n),h--,h||e(c)};f--;)r=n[f],o=u[r],o?t(r,o):(i=s[r]=s[r]||[],i.push(t))}function e(n,e){if(n){var t=s[n];if(u[n]=e,t)for(;t.length;)t[0](n,e),t.splice(0,1)}}function t(n,e,r,o){var i,c,u=document,s=r.async,f=r.numTries||1;o=o||0,/\.css$/.test(n)?(i=!0,c=u.createElement("link"),c.rel="stylesheet",c.href=n):(c=u.createElement("script"),c.src=n,c.async=void 0===s||s),c.onload=c.onerror=c.onbeforeload=function(u){var s=u.type[0];if(i&&"hideFocus"in c)try{c.sheet.cssText.length||(s="e")}catch(n){s="e"}return"e"==s&&(o+=1,o<f)?t(n,e,r,o):void e(n,s,u.defaultPrevented)},u.head.appendChild(c)}function r(n,e,r){n=n.push?n:[n];var o,i,c=n.length,u=c,s=[];for(o=function(n,t,r){if("e"==t&&s.push(n),"b"==t){if(!r)return;s.push(n)}c--,c||e(s)},i=0;i<u;i++)t(n[i],o,r)}function o(n,t,o){var u,s;if(t&&t.trim&&(u=t),s=(u?o:t)||{},u){if(u in c)throw new Error("LoadJS");c[u]=!0}r(n,function(n){n.length?(s.error||i)(n):(s.success||i)(),e(u,n)},s)}var i=function(){},c={},u={},s={};return o.ready=function(e,t){return n(e,function(n){n.length?(t.error||i)(n):(t.success||i)()}),o},o.done=function(n){e(n,[])},o}(); | ||
loadjs=function(){function n(n,e){n=n.push?n:[n];var t,r,o,i,c=[],f=n.length,h=f;for(t=function(n,t){t.length&&c.push(n),h--,h||e(c)};f--;)r=n[f],o=u[r],o?t(r,o):(i=s[r]=s[r]||[],i.push(t))}function e(n,e){if(n){var t=s[n];if(u[n]=e,t)for(;t.length;)t[0](n,e),t.splice(0,1)}}function t(n,e,r,o){var i,c,u=document,s=r.async,f=(r.numRetries||0)+1;o=o||0,/\.css$/.test(n)?(i=!0,c=u.createElement("link"),c.rel="stylesheet",c.href=n):(c=u.createElement("script"),c.src=n,c.async=void 0===s||s),c.onload=c.onerror=c.onbeforeload=function(u){var s=u.type[0];if(i&&"hideFocus"in c)try{c.sheet.cssText.length||(s="e")}catch(n){s="e"}return"e"==s&&(o+=1,o<f)?t(n,e,r,o):void e(n,s,u.defaultPrevented)},u.head.appendChild(c)}function r(n,e,r){n=n.push?n:[n];var o,i,c=n.length,u=c,s=[];for(o=function(n,t,r){if("e"==t&&s.push(n),"b"==t){if(!r)return;s.push(n)}c--,c||e(s)},i=0;i<u;i++)t(n[i],o,r)}function o(n,t,o){var u,s;if(t&&t.trim&&(u=t),s=(u?o:t)||{},u){if(u in c)throw new Error("LoadJS");c[u]=!0}r(n,function(n){n.length?(s.error||i)(n):(s.success||i)(),e(u,n)},s)}var i=function(){},c={},u={},s={};return o.ready=function(e,t){return n(e,function(n){n.length?(t.error||i)(n):(t.success||i)()}),o},o.done=function(n){e(n,[])},o}(); |
@@ -124,12 +124,10 @@ /** | ||
it('should support multiple tries', function(done) { | ||
var numTries = 0; | ||
loadjs('assets/file-doesntexist-numtries.js', { | ||
loadjs('assets/file-numretries.js', { | ||
error: function() { | ||
// check number of scripts in document | ||
var selector = 'script[src="assets/file-doesntexist-numtries.js"]', | ||
var selector = 'script[src="assets/file-numretries.js"]', | ||
scripts = document.querySelectorAll(selector); | ||
if (scripts.length === 2) done(); | ||
}, | ||
numTries: 2 | ||
numRetries: 1 | ||
}); | ||
@@ -136,0 +134,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347584
11791