Comparing version 3.5.0 to 3.5.1
{ | ||
"name": "loadjs", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "authors": [ |
# LoadJS Changelog | ||
## 3.5.1 - August 9, 2017 | ||
* Upgraded devDependencies and re-built payload | ||
## 3.5.0 - March 28, 2017 | ||
@@ -4,0 +8,0 @@ |
@@ -1,1 +0,1 @@ | ||
loadjs=function(){function e(e,n){e=e.push?e:[e];var t,r,i,c,o=[],f=e.length,a=f;for(t=function(e,t){t.length&&o.push(e),--a||n(o)};f--;)r=e[f],i=s[r],i?t(r,i):(c=u[r]=u[r]||[],c.push(t))}function n(e,n){if(e){var t=u[e];if(s[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function t(e,n,r,i){var o,s,u=document,f=r.async,a=(r.numRetries||0)+1,h=r.before||c;i=i||0,/(^css!|\.css$)/.test(e)?(o=!0,s=u.createElement("link"),s.rel="stylesheet",s.href=e.replace(/^css!/,"")):(s=u.createElement("script"),s.src=e,s.async=void 0===f||f),s.onload=s.onerror=s.onbeforeload=function(c){var u=c.type[0];if(o&&"hideFocus"in s)try{s.sheet.cssText.length||(u="e")}catch(e){u="e"}if("e"==u&&(i+=1)<a)return t(e,n,r,i);n(e,u,c.defaultPrevented)},h(e,s)!==!1&&u.head.appendChild(s)}function r(e,n,r){e=e.push?e:[e];var i,c,o=e.length,s=o,u=[];for(i=function(e,t,r){if("e"==t&&u.push(e),"b"==t){if(!r)return;u.push(e)}--o||n(u)},c=0;c<s;c++)t(e[c],i,r)}function i(e,t,i){var s,u;if(t&&t.trim&&(s=t),u=(s?i:t)||{},s){if(s in o)throw"LoadJS";o[s]=!0}r(e,function(e){e.length?(u.error||c)(e):(u.success||c)(),n(s,e)},u)}var c=function(){},o={},s={},u={};return i.ready=function(n,t){return e(n,function(e){e.length?(t.error||c)(e):(t.success||c)()}),i},i.done=function(e){n(e,[])},i.reset=function(){o={},s={},u={}},i.isDefined=function(e){return e in o},i}(); | ||
loadjs=function(){function e(e,n){var t,r,i,c=[],o=(e=e.push?e:[e]).length,f=o;for(t=function(e,t){t.length&&c.push(e),--f||n(c)};o--;)r=e[o],(i=s[r])?t(r,i):(u[r]=u[r]||[]).push(t)}function n(e,n){if(e){var t=u[e];if(s[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function t(e,n,r,i){var o,s,u=document,f=r.async,a=(r.numRetries||0)+1,h=r.before||c;i=i||0,/(^css!|\.css$)/.test(e)?(o=!0,(s=u.createElement("link")).rel="stylesheet",s.href=e.replace(/^css!/,"")):((s=u.createElement("script")).src=e,s.async=void 0===f||f),s.onload=s.onerror=s.onbeforeload=function(c){var u=c.type[0];if(o&&"hideFocus"in s)try{s.sheet.cssText.length||(u="e")}catch(e){u="e"}if("e"==u&&(i+=1)<a)return t(e,n,r,i);n(e,u,c.defaultPrevented)},!1!==h(e,s)&&u.head.appendChild(s)}function r(e,n,r){var i,c,o=(e=e.push?e:[e]).length,s=o,u=[];for(i=function(e,t,r){if("e"==t&&u.push(e),"b"==t){if(!r)return;u.push(e)}--o||n(u)},c=0;c<s;c++)t(e[c],i,r)}function i(e,t,i){var s,u;if(t&&t.trim&&(s=t),u=(s?i:t)||{},s){if(s in o)throw"LoadJS";o[s]=!0}r(e,function(e){e.length?(u.error||c)(e):(u.success||c)(),n(s,e)},u)}var c=function(){},o={},s={},u={};return i.ready=function(n,t){return e(n,function(e){e.length?(t.error||c)(e):(t.success||c)()}),i},i.done=function(e){n(e,[])},i.reset=function(){o={},s={},u={}},i.isDefined=function(e){return e in o},i}(); |
@@ -1,1 +0,1 @@ | ||
loadjs=function(){function e(e,n){e=e.push?e:[e];var t,r,i,c,o=[],f=e.length,a=f;for(t=function(e,t){t.length&&o.push(e),--a||n(o)};f--;)r=e[f],i=s[r],i?t(r,i):(c=u[r]=u[r]||[],c.push(t))}function n(e,n){if(e){var t=u[e];if(s[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function t(e,n,r,i){var o,s,u=document,f=r.async,a=(r.numRetries||0)+1,h=r.before||c;i=i||0,/(^css!|\.css$)/.test(e)?(o=!0,s=u.createElement("link"),s.rel="stylesheet",s.href=e.replace(/^css!/,"")):(s=u.createElement("script"),s.src=e,s.async=void 0===f||f),s.onload=s.onerror=s.onbeforeload=function(c){var u=c.type[0];if(o&&"hideFocus"in s)try{s.sheet.cssText.length||(u="e")}catch(e){u="e"}if("e"==u&&(i+=1)<a)return t(e,n,r,i);n(e,u,c.defaultPrevented)},h(e,s)!==!1&&u.head.appendChild(s)}function r(e,n,r){e=e.push?e:[e];var i,c,o=e.length,s=o,u=[];for(i=function(e,t,r){if("e"==t&&u.push(e),"b"==t){if(!r)return;u.push(e)}--o||n(u)},c=0;c<s;c++)t(e[c],i,r)}function i(e,t,i){var s,u;if(t&&t.trim&&(s=t),u=(s?i:t)||{},s){if(s in o)throw"LoadJS";o[s]=!0}r(e,function(e){e.length?(u.error||c)(e):(u.success||c)(),n(s,e)},u)}var c=function(){},o={},s={},u={};return i.ready=function(n,t){return e(n,function(e){e.length?(t.error||c)(e):(t.success||c)()}),i},i.done=function(e){n(e,[])},i.reset=function(){o={},s={},u={}},i.isDefined=function(e){return e in o},i}(); | ||
loadjs=function(){function e(e,n){var t,r,i,c=[],o=(e=e.push?e:[e]).length,f=o;for(t=function(e,t){t.length&&c.push(e),--f||n(c)};o--;)r=e[o],(i=s[r])?t(r,i):(u[r]=u[r]||[]).push(t)}function n(e,n){if(e){var t=u[e];if(s[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function t(e,n,r,i){var o,s,u=document,f=r.async,a=(r.numRetries||0)+1,h=r.before||c;i=i||0,/(^css!|\.css$)/.test(e)?(o=!0,(s=u.createElement("link")).rel="stylesheet",s.href=e.replace(/^css!/,"")):((s=u.createElement("script")).src=e,s.async=void 0===f||f),s.onload=s.onerror=s.onbeforeload=function(c){var u=c.type[0];if(o&&"hideFocus"in s)try{s.sheet.cssText.length||(u="e")}catch(e){u="e"}if("e"==u&&(i+=1)<a)return t(e,n,r,i);n(e,u,c.defaultPrevented)},!1!==h(e,s)&&u.head.appendChild(s)}function r(e,n,r){var i,c,o=(e=e.push?e:[e]).length,s=o,u=[];for(i=function(e,t,r){if("e"==t&&u.push(e),"b"==t){if(!r)return;u.push(e)}--o||n(u)},c=0;c<s;c++)t(e[c],i,r)}function i(e,t,i){var s,u;if(t&&t.trim&&(s=t),u=(s?i:t)||{},s){if(s in o)throw"LoadJS";o[s]=!0}r(e,function(e){e.length?(u.error||c)(e):(u.success||c)(),n(s,e)},u)}var c=function(){},o={},s={},u={};return i.ready=function(n,t){return e(n,function(e){e.length?(t.error||c)(e):(t.success||c)()}),i},i.done=function(e){n(e,[])},i.reset=function(){o={},s={},u={}},i.isDefined=function(e){return e in o},i}(); |
{ | ||
"name": "loadjs", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"license": "MIT", | ||
@@ -30,10 +30,10 @@ "description": "Tiny async loader for modern browsers", | ||
"devDependencies": { | ||
"del": "2.2.2", | ||
"del": "3.0.0", | ||
"gulp": "git+https://github.com/gulpjs/gulp#4.0", | ||
"gulp-jshint": "2.0.4", | ||
"gulp-rename": "1.2.2", | ||
"gulp-uglify": "2.1.2", | ||
"gulp-uglify": "3.0.0", | ||
"gulp-umd": "^0.2.1", | ||
"jshint": "^2.9.4" | ||
"jshint": "^2.9.5" | ||
} | ||
} |
310
README.md
@@ -9,2 +9,3 @@ # LoadJS | ||
[![devDependency Status](https://david-dm.org/muicss/loadjs/dev-status.svg)](https://david-dm.org/muicss/loadjs#info=devDependencies) | ||
[![CDNJS](https://img.shields.io/cdnjs/v/loadjs.svg)](https://cdnjs.com/libraries/loadjs) | ||
@@ -31,4 +32,4 @@ ## Introduction | ||
The latest version of LoadJS can be found in the `dist/` directory in this repository: | ||
* [loadjs.js](https://raw.githubusercontent.com/muicss/loadjs/master/dist/loadjs.js) | ||
* [loadjs.min.js](https://raw.githubusercontent.com/muicss/loadjs/master/dist/loadjs.min.js) | ||
* [loadjs.js](https://cdn.rawgit.com/muicss/loadjs/3.5.1/dist/loadjs.js) | ||
* [loadjs.min.js](https://cdn.rawgit.com/muicss/loadjs/3.5.1/dist/loadjs.min.js) | ||
@@ -73,176 +74,175 @@ You can also use it as a CJS or AMD module: | ||
```javascript | ||
loadjs('/path/to/foo.js', { | ||
success: function() { /* foo.js loaded */} | ||
}); | ||
``` | ||
```javascript | ||
loadjs('/path/to/foo.js', { | ||
success: function() { /* foo.js loaded */} | ||
}); | ||
``` | ||
1. Fetch files in parallel and load them asynchronously | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
``` | ||
1. Fetch files in parallel and load them in series | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], { | ||
success: function() { /* foo.js and bar.js loaded in series */ }, | ||
async: false | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], { | ||
success: function() { /* foo.js and bar.js loaded in series */ }, | ||
async: false | ||
}); | ||
``` | ||
1. Fetch JavaScript and CSS files | ||
```javascript | ||
loadjs(['/path/to/foo.css', '/path/to/bar.js'], { | ||
success: function() { /* foo.css and bar.js loaded */ } | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['/path/to/foo.css', '/path/to/bar.js'], { | ||
success: function() { /* foo.css and bar.js loaded */ } | ||
}); | ||
``` | ||
1. Force treating file as CSS stylesheet | ||
```javascript | ||
loadjs(['css!/path/to/cssfile.custom'], { | ||
success: function() { /* cssfile.custom loaded as stylesheet */ } | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['css!/path/to/cssfile.custom'], { | ||
success: function() { /* cssfile.custom loaded as stylesheet */ } | ||
}); | ||
``` | ||
1. Add a bundle id | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
``` | ||
1. Check if bundle has already been defined | ||
```javascript | ||
if (!loadjs.isDefined('foobar')) { | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
} | ||
``` | ||
``` | ||
1. Check if bundle has already been defined | ||
```javascript | ||
if (!loadjs.isDefined('foobar')) { | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
} | ||
``` | ||
1. Add an error callback | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ }, | ||
error: function(pathsNotFound) { /* at least one path didn't load */ } | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ }, | ||
error: function(pathsNotFound) { /* at least one path didn't load */ } | ||
}); | ||
``` | ||
1. Retry files before calling the error callback | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ }, | ||
error: function(pathsNotFound) { /* at least one path didn't load */ }, | ||
numRetries: 3 | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ }, | ||
error: function(pathsNotFound) { /* at least one path didn't load */ }, | ||
numRetries: 3 | ||
}); | ||
``` | ||
1. Execute a callback before script tags are embedded | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], { | ||
success: function() {}, | ||
error: function(pathsNotFound) {}, | ||
before: function(path, scriptEl) { | ||
/* called for each script node before being embedded */ | ||
if (path === '/path/to/foo.js') scriptEl.crossOrigin = true; | ||
} | ||
}); | ||
``` | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], { | ||
success: function() {}, | ||
error: function(pathsNotFound) {}, | ||
before: function(path, scriptEl) { | ||
/* called for each script node before being embedded */ | ||
if (path === '/path/to/foo.js') scriptEl.crossOrigin = true; | ||
} | ||
}); | ||
``` | ||
1. Bypass LoadJS default DOM insertion mechanism (DOM `<head>`) | ||
```javascript | ||
loadjs(['/path/to/foo.js'], { | ||
success: function() {}, | ||
error: function(pathsNotFound) {}, | ||
before: function(path, scriptEl) { | ||
document.body.appendChild(scriptEl); | ||
```javascript | ||
loadjs(['/path/to/foo.js'], { | ||
success: function() {}, | ||
error: function(pathsNotFound) {}, | ||
before: function(path, scriptEl) { | ||
document.body.appendChild(scriptEl); | ||
/* return `false` to bypass default DOM insertion mechanism */ | ||
return false; | ||
} | ||
}); | ||
``` | ||
/* return `false` to bypass default DOM insertion mechanism */ | ||
return false; | ||
} | ||
}); | ||
``` | ||
1. Execute a callback after bundle finishes loading | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar'); | ||
```javascript | ||
loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar'); | ||
loadjs.ready('foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
``` | ||
loadjs.ready('foobar', { | ||
success: function() { /* foo.js & bar.js loaded */ } | ||
}); | ||
``` | ||
1. Chain .ready() together | ||
```javascript | ||
loadjs('/path/to/foo.js', 'foo'); | ||
loadjs('/path/to/bar.js', 'bar'); | ||
```javascript | ||
loadjs('/path/to/foo.js', 'foo'); | ||
loadjs('/path/to/bar.js', 'bar'); | ||
loadjs | ||
.ready('foo', { | ||
success: function() { /* foo.js loaded */ } | ||
}) | ||
.ready('bar', { | ||
success: function() { /* bar.js loaded */ } | ||
}); | ||
``` | ||
loadjs | ||
.ready('foo', { | ||
success: function() { /* foo.js loaded */ } | ||
}) | ||
.ready('bar', { | ||
success: function() { /* bar.js loaded */ } | ||
}); | ||
``` | ||
1. Compose more complex dependency lists | ||
```javascript | ||
loadjs('/path/to/foo.js', 'foo'); | ||
loadjs('/path/to/bar.js', 'bar'); | ||
loadjs(['/path/to/thunkor.js', '/path/to/thunky.js'], 'thunk'); | ||
```javascript | ||
loadjs('/path/to/foo.js', 'foo'); | ||
loadjs('/path/to/bar.js', 'bar'); | ||
loadjs(['/path/to/thunkor.js', '/path/to/thunky.js'], 'thunk'); | ||
// wait for multiple depdendencies | ||
loadjs.ready(['foo', 'bar', 'thunk'], { | ||
success: function() { | ||
// foo.js & bar.js & thunkor.js & thunky.js loaded | ||
}, | ||
error: function(depsNotFound) { | ||
if (depsNotFound.indexOf('foo') > -1) {}; // foo failed | ||
if (depsNotFound.indexOf('bar') > -1) {}; // bar failed | ||
if (depsNotFound.indexOf('thunk') > -1) {}; // thunk failed | ||
} | ||
}); | ||
``` | ||
// wait for multiple depdendencies | ||
loadjs.ready(['foo', 'bar', 'thunk'], { | ||
success: function() { | ||
// foo.js & bar.js & thunkor.js & thunky.js loaded | ||
}, | ||
error: function(depsNotFound) { | ||
if (depsNotFound.indexOf('foo') > -1) {}; // foo failed | ||
if (depsNotFound.indexOf('bar') > -1) {}; // bar failed | ||
if (depsNotFound.indexOf('thunk') > -1) {}; // thunk failed | ||
} | ||
}); | ||
``` | ||
1. Use .done() for more control | ||
```javascript | ||
loadjs.ready(['dependency1', 'dependency2'], { | ||
success: function() { | ||
// run code after dependencies have been met | ||
```javascript | ||
loadjs.ready(['dependency1', 'dependency2'], { | ||
success: function() { | ||
// run code after dependencies have been met | ||
} | ||
}); | ||
function fn1() { | ||
loadjs.done('dependency1'); | ||
} | ||
}); | ||
function fn1() { | ||
loadjs.done('dependency1'); | ||
} | ||
function fn2() { | ||
loadjs.done('dependency2'); | ||
} | ||
``` | ||
function fn2() { | ||
loadjs.done('dependency2'); | ||
} | ||
``` | ||
1. Reset dependency trackers | ||
```javascript | ||
loadjs.reset(); | ||
``` | ||
```javascript | ||
loadjs.reset(); | ||
``` | ||
## Directory structure | ||
@@ -271,57 +271,57 @@ | ||
* [nodejs](http://nodejs.org/) | ||
* [npm](https://www.npmjs.org/) | ||
* http-server (via npm) | ||
* [nodejs](http://nodejs.org/) | ||
* [npm](https://www.npmjs.org/) | ||
* http-server (via npm) | ||
1. Clone repository | ||
```bash | ||
$ git clone git@github.com:muicss/loadjs.git | ||
$ cd loadjs | ||
``` | ||
```bash | ||
$ git clone git@github.com:muicss/loadjs.git | ||
$ cd loadjs | ||
``` | ||
1. Install node dependencies using npm | ||
```bash | ||
$ npm install | ||
``` | ||
```bash | ||
$ npm install | ||
``` | ||
1. Build examples | ||
```bash | ||
$ npm run build-examples | ||
``` | ||
```bash | ||
$ npm run build-examples | ||
``` | ||
To view the examples you can use any static file server. To use the `nodejs` http-server module: | ||
To view the examples you can use any static file server. To use the `nodejs` http-server module: | ||
```bash | ||
$ npm install http-server | ||
$ npm run http-server -- -p 3000 | ||
``` | ||
```bash | ||
$ npm install http-server | ||
$ npm run http-server -- -p 3000 | ||
``` | ||
Then visit [http://localhost:3000/examples](http://localhost:3000/examples) | ||
Then visit [http://localhost:3000/examples](http://localhost:3000/examples) | ||
1. Build distribution files | ||
```bash | ||
$ npm run build-dist | ||
``` | ||
```bash | ||
$ npm run build-dist | ||
``` | ||
The files will be located in the `dist` directory. | ||
The files will be located in the `dist` directory. | ||
1. Run tests | ||
To run the browser tests first build the `loadjs` library: | ||
To run the browser tests first build the `loadjs` library: | ||
```bash | ||
$ npm run build-tests | ||
``` | ||
```bash | ||
$ npm run build-tests | ||
``` | ||
Then visit [http://localhost:3000/test](http://localhost:3000/test) | ||
Then visit [http://localhost:3000/test](http://localhost:3000/test) | ||
1. Build all files | ||
```bash | ||
$ npm run build-all | ||
``` | ||
```bash | ||
$ npm run build-all | ||
``` | ||
@@ -15,3 +15,3 @@ # Release Instructions | ||
1. Update README.md (if necessary) | ||
1. Update CDN urls in README.md | ||
@@ -18,0 +18,0 @@ 1. Commit changes and tag code |
@@ -1,1 +0,1 @@ | ||
loadjs=function(){function e(e,n){e=e.push?e:[e];var t,r,i,c,o=[],f=e.length,a=f;for(t=function(e,t){t.length&&o.push(e),--a||n(o)};f--;)r=e[f],i=s[r],i?t(r,i):(c=u[r]=u[r]||[],c.push(t))}function n(e,n){if(e){var t=u[e];if(s[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function t(e,n,r,i){var o,s,u=document,f=r.async,a=(r.numRetries||0)+1,h=r.before||c;i=i||0,/(^css!|\.css$)/.test(e)?(o=!0,s=u.createElement("link"),s.rel="stylesheet",s.href=e.replace(/^css!/,"")):(s=u.createElement("script"),s.src=e,s.async=void 0===f||f),s.onload=s.onerror=s.onbeforeload=function(c){var u=c.type[0];if(o&&"hideFocus"in s)try{s.sheet.cssText.length||(u="e")}catch(e){u="e"}if("e"==u&&(i+=1)<a)return t(e,n,r,i);n(e,u,c.defaultPrevented)},h(e,s)!==!1&&u.head.appendChild(s)}function r(e,n,r){e=e.push?e:[e];var i,c,o=e.length,s=o,u=[];for(i=function(e,t,r){if("e"==t&&u.push(e),"b"==t){if(!r)return;u.push(e)}--o||n(u)},c=0;c<s;c++)t(e[c],i,r)}function i(e,t,i){var s,u;if(t&&t.trim&&(s=t),u=(s?i:t)||{},s){if(s in o)throw"LoadJS";o[s]=!0}r(e,function(e){e.length?(u.error||c)(e):(u.success||c)(),n(s,e)},u)}var c=function(){},o={},s={},u={};return i.ready=function(n,t){return e(n,function(e){e.length?(t.error||c)(e):(t.success||c)()}),i},i.done=function(e){n(e,[])},i.reset=function(){o={},s={},u={}},i.isDefined=function(e){return e in o},i}(); | ||
loadjs=function(){function e(e,n){var t,r,i,c=[],o=(e=e.push?e:[e]).length,f=o;for(t=function(e,t){t.length&&c.push(e),--f||n(c)};o--;)r=e[o],(i=s[r])?t(r,i):(u[r]=u[r]||[]).push(t)}function n(e,n){if(e){var t=u[e];if(s[e]=n,t)for(;t.length;)t[0](e,n),t.splice(0,1)}}function t(e,n,r,i){var o,s,u=document,f=r.async,a=(r.numRetries||0)+1,h=r.before||c;i=i||0,/(^css!|\.css$)/.test(e)?(o=!0,(s=u.createElement("link")).rel="stylesheet",s.href=e.replace(/^css!/,"")):((s=u.createElement("script")).src=e,s.async=void 0===f||f),s.onload=s.onerror=s.onbeforeload=function(c){var u=c.type[0];if(o&&"hideFocus"in s)try{s.sheet.cssText.length||(u="e")}catch(e){u="e"}if("e"==u&&(i+=1)<a)return t(e,n,r,i);n(e,u,c.defaultPrevented)},!1!==h(e,s)&&u.head.appendChild(s)}function r(e,n,r){var i,c,o=(e=e.push?e:[e]).length,s=o,u=[];for(i=function(e,t,r){if("e"==t&&u.push(e),"b"==t){if(!r)return;u.push(e)}--o||n(u)},c=0;c<s;c++)t(e[c],i,r)}function i(e,t,i){var s,u;if(t&&t.trim&&(s=t),u=(s?i:t)||{},s){if(s in o)throw"LoadJS";o[s]=!0}r(e,function(e){e.length?(u.error||c)(e):(u.success||c)(),n(s,e)},u)}var c=function(){},o={},s={},u={};return i.ready=function(n,t){return e(n,function(e){e.length?(t.error||c)(e):(t.success||c)()}),i},i.done=function(e){n(e,[])},i.reset=function(){o={},s={},u={}},i.isDefined=function(e){return e in o},i}(); |
@@ -191,5 +191,6 @@ /** | ||
xit('it should report ad blocked scripts as missing', function(done) { | ||
var blockedScript = 'https://www.googletagservices.com/tag/js/gpt.js'; | ||
var s1 = 'https://www.googletagservices.com/tag/js/gpt.js', | ||
s2 = 'https://munchkin.marketo.net/munchkin-beta.js'; | ||
loadjs([blockedScript, 'assets/file1.js'], { | ||
loadjs([s1, s2, 'assets/file1.js'], { | ||
success: function() { | ||
@@ -200,4 +201,5 @@ throw new Error('Executed success callback'); | ||
assert.equal(pathsLoaded['file1.js'], true); | ||
assert.equal(pathsNotFound.length, 1); | ||
assert.equal(pathsNotFound[0], blockedScript); | ||
assert.equal(pathsNotFound.length, 2); | ||
assert.equal(pathsNotFound[0], s1); | ||
assert.equal(pathsNotFound[1], s2); | ||
done(); | ||
@@ -320,3 +322,3 @@ } | ||
it('should call errorure on missing external file', function(done) { | ||
it('should call error on missing external file', function(done) { | ||
this.timeout(0); | ||
@@ -323,0 +325,0 @@ |
Sorry, the diff of this file is not supported yet
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
355469
11982