tiny-loader
v2.0.0
Published
minimal JavaScript loader, intended for loading polyfills up front
Downloads
270
Readme
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