get-js
A lightweight library to asynchronously load scripts on the fly.
Installation
# Using npm $ npm install get-js --save # Using Yarn $ yarn add get-js # Using Bower $ bower install get-js --save
For older browsers you may also need a promise polyfill.
# Install promise polyfill. $ npm install es6-promise
Usage
Use it in your project with require
or import
as an ES module.
var get = ; // ES2015+;
Or, using <script>
tags:
Here you go:
// Load a single script; // Load multiple scripts, without changing the order ;
Using with Angular
Note: This refers to angular 1.x projects.
You can inject this in your angular code as a service.
Require the angular module using
var angularGetJs = ;
Or
Then you should be able to use it like this:
// Add the module as a dependency in your app.angular; // Inject the serviceangular;
License
This package is licensed under the MIT License.