@radulucut/scripts
v3.0.0
Published
Load and keep track of scripts in the DOM
Downloads
12
Maintainers
Readme
scripts - Dynamic script loader for DOM
Load and keep track of scripts in the DOM.
Install
$ npm install @radulucut/scripts
Usage
import Scripts from "@radulucut/scripts";
const scripts = Scripts(document);
scripts.Load(
"./script.js",
() => {
console.log("script loaded");
},
() => {
console.error("Failed to load script");
}
);
scripts.Load(
"https://code.jquery.com/jquery-3.5.1.min.js",
() => {
console.log("jQuery loaded");
},
() => {
console.error("Failed to load jQuery");
}
);
const isLoaded = scripts.IsLoaded("./script2.js"); // false