2.0.0 • Published 4 years ago

tiny-loader v2.0.0

Weekly downloads
73
License
Apache-2.0
Repository
github
Last release
4 years ago

tiny, dependency-free JavaScript loader — intended primarily for loading polyfills or common libraries up front

loadScripts(["foo.js", "bar.js", "baz.js"], function() {
    // all aforementioned scripts have been loaded
});

(scripts are loaded and executed sequentially)

you can also pass an object in order to assign arbitrary attributes to the generated script tag, e.g. for Subresource Integrity:

loadScripts([{
    src: "https://cdn.example.org/lib.js",
    integrity: "sha256-Ijl…1bE=",
    crossorigin: "anonymous"
}]);

prompted by Loading Polyfills Only When Needed, which explains why document.write should be avoided

see samples directory for usage examples

2.0.0

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.5.0

7 years ago