New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zodash/load-script

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zodash/load-script - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.1.4](https://github.com/zcorky/zodash/compare/@zodash/load-script@0.1.3...@zodash/load-script@0.1.4) (2020-11-26)
**Note:** Version bump only for package @zodash/load-script
## 0.1.3 (2020-11-11)

@@ -8,0 +16,0 @@

23

lib/load-script.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.usingFetch = exports.usingAjax = exports.loadScript = void 0;
const cache = new Map();
function loadScript(path) {
return new Promise((resolve, reject) => {
if (cache.get(path)) {
return resolve();
}
const script = document.createElement('script');

@@ -11,3 +15,4 @@ script.src = path;

script.onload = () => {
resolve();
cache.set(path, true);
return resolve();
};

@@ -20,2 +25,5 @@ document.head.appendChild(script);

return new Promise((resolve, reject) => {
if (cache.get(path)) {
return resolve();
}
const xhr = new XMLHttpRequest();

@@ -28,3 +36,6 @@ xhr.onreadystatechange = function () {

document.head.appendChild(script);
setTimeout(resolve, 0);
setTimeout(() => {
cache.set(path, true);
return resolve();
}, 0);
}

@@ -40,2 +51,5 @@ };

return new Promise((resolve, reject) => {
if (cache.get(path)) {
return resolve();
}
return fetch(path)

@@ -48,3 +62,6 @@ .then(res => res.text())

document.head.appendChild(script);
setTimeout(resolve, 0);
setTimeout(() => {
cache.set(path, true);
return resolve();
}, 0);
});

@@ -51,0 +68,0 @@ });

4

package.json
{
"name": "@zodash/load-script",
"version": "0.1.3",
"version": "0.1.4",
"description": "Dynamic load script",

@@ -68,3 +68,3 @@ "keywords": [

},
"gitHead": "fb0b997fc51fbad9866a754bf8609d0bcc962700"
"gitHead": "1e8662170d99de2cfd4095e1cdbb0f6e89fd4d49"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc