Tinyloader
Version 1.1.0
A tiny script loader (~3KB) using async and ES6 Promises
Installation
npm install --save tinyloader
Script tag
or import in your project
var tinyloader = ;
Use Tinyloader
tinyloader ;
- url: String or Array
- mode: String 'async' or 'defer' (default: 'async')
- fail: Object { script: String url_failed, error: Error Object e}
Example (see example/example.js for more info)
tinyloader ;
With an array
let myScripts = 'https://code.jquery.com/jquery-3.0.0.min.js' 'https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js' 'https://cdnjs.cloudflare.com/ajax/libs/three.js/r58/three.js'; tinyloader ;
et voilà !
Development
Want to contribute? Great!
TinyLoader uses Webpack for fast developing. Make a change in your file and instantanously see your updates!
Open your favorite Terminal and run these commands.
$ git clone https://github.com/tom4dev/tinyloader tinyloader$ cd tinyloader$ npm install
Developpment mode watcher (Webpack):
- Start webpack-dev-server
$ npm start
- Start watching js files
$ npm run watch
... And you're ready to code !
License
MIT
Open source, Hell Yeah.