Socket
Socket
Sign inDemoInstall

browser-script-loader

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1 to 3.0.2

2

package.json
{
"name": "browser-script-loader",
"version": "3.0.1",
"version": "3.0.2",
"description": "a simple & lightweight script loader,provide sync & async way to load script",

@@ -5,0 +5,0 @@ "main": "script-loader.js",

@@ -75,3 +75,5 @@ /**

scriptList = slice.call(arguments),
loadedCallback = scriptList[scriptList.length - 1];
loadedCallback = scriptList[scriptList.length - 1] || function noop() {
},
nonLoadScripts;

@@ -82,2 +84,31 @@ if (typeof loadedCallback === 'function') {

nonLoadScripts = scriptList.filter(function (scriptSrc) {
return !~loadedScripts.indexOf(scriptSrc);
}); // 未加载过的脚本列表
if (nonLoadScripts.length) {
nonLoadScripts.forEach(function (scriptSrc) {
var scriptDom;
// 脚本第一次加载
if (!~loadedScripts.indexOf(scriptSrc)) {
counter++;
scriptDom = creteScriptDom(scriptSrc);
addCallbackWhenScriptLoaded(scriptDom, loadedCallback);
headEl.appendChild(scriptDom);
loadedScripts.push(scriptSrc);
}
});
} else {
loadedCallback();
}
return ScriptLoader;
function addCallbackWhenScriptLoaded(scriptDom, func) {

@@ -106,22 +137,2 @@

}
scriptList.forEach(function (scriptSrc) {
var scriptDom;
// 脚本第一次加载
if (!~loadedScripts.indexOf(scriptSrc)) {
counter++;
scriptDom = creteScriptDom(scriptSrc);
addCallbackWhenScriptLoaded(scriptDom, loadedCallback || function noop() {
});
headEl.appendChild(scriptDom);
loadedScripts.push(scriptSrc);
}
});
return ScriptLoader;
},

@@ -128,0 +139,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc