script utils for creating script element and adding/removing them from <head>
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
js
test
.gitignore
LICENSE
Makefile
README.md
license-mini
package.json
script-utils-browser.js
script-utils.min.js

README.md

script

Script utils to create script elements, add and remove them from <head>

Installation

npm install script-utils

In the browser:

<script src="script-utils-browser.js"></script>

Usage

var script = require("script-utils");

// create a new script element with an onload callback
var newScript = script.create("source/to/file", function onload() {
	// do something when script is loaded;
}, this);

// Append the script to &lt;head&gt;
script.append(newScript);

// Remove script from &lt;head&gt;
script.remove(newScript);

Licence

MIT