react-async-load-script
Advanced tools
Comparing version 1.0.4 to 1.0.5
import React from 'react' | ||
import asyncScript from 'async-script' | ||
import asyncScript from './asyncscript.js' | ||
@@ -19,3 +19,3 @@ /** | ||
export function loadScripts (scripts) { | ||
return scripts.reduce((cur, next) => cur.then(() => createPromise(next)), new Promise((resolve) => resolve())) | ||
return Promise.all(scripts.map((url) => createPromise(url))) | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -69,5 +69,5 @@ 'use strict'; | ||
var _asyncScript = require('async-script'); | ||
var _asyncscript = require('./asyncscript.js'); | ||
var _asyncScript2 = _interopRequireDefault(_asyncScript); | ||
var _asyncscript2 = _interopRequireDefault(_asyncscript); | ||
@@ -88,3 +88,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return new Promise(function (resolve, reject) { | ||
(0, _asyncScript2.default)(document, url, function (err) { | ||
(0, _asyncscript2.default)(document, url, function (err) { | ||
return err ? reject(err) : resolve(url); | ||
@@ -100,8 +100,4 @@ }); | ||
function loadScripts(scripts) { | ||
return scripts.reduce(function (cur, next) { | ||
return cur.then(function () { | ||
return createPromise(next); | ||
}); | ||
}, new Promise(function (resolve) { | ||
return resolve(); | ||
return Promise.all(scripts.map(function (url) { | ||
return createPromise(url); | ||
})); | ||
@@ -108,0 +104,0 @@ } |
{ | ||
"name": "react-async-load-script", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Async script loader HOC for React", | ||
@@ -8,3 +8,3 @@ "main": "lib/index.js", | ||
"test": "jest", | ||
"watch": "BABEL_ENV=production babel --watch index.js --out-dir lib", | ||
"watch": "BABEL_ENV=production babel --watch *.js --out-dir lib", | ||
"prettier": "prettier-standard 'index.js'", | ||
@@ -18,3 +18,3 @@ "test:watch": "yarn test --watchAll", | ||
"dependencies": { | ||
"async-script": "^0.0.1" | ||
"one-time": "^0.0.4" | ||
}, | ||
@@ -42,4 +42,6 @@ "devDependencies": { | ||
"setupTestFrameworkScriptFile": "<rootDir>/__tests__/setup.js", | ||
"testPathIgnorePatterns": ["<rootDir>/__tests__/setup.js"] | ||
"testPathIgnorePatterns": [ | ||
"<rootDir>/__tests__/setup.js" | ||
] | ||
} | ||
} |
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
168364
12
319
+ Addedone-time@^0.0.4
- Removedasync-script@^0.0.1
- Removedasync-script@0.0.1(transitive)