tiny-script-loader
v2.2.2
Published
Tiny script loader
Downloads
1,133
Readme
Tiny Script Loader
The purpose of this library is to be the smallest callback & Promise -based script loader.
Usage
Callback
var loadScript = require('tiny-script-loader/loadScript')
loadScript('https://example.com/script.js', function () {
console.log('loaded')
})
Promise
var loadScript = require('tiny-script-loader/loadScriptPromised')
loadScript('https://example.com/script.js')
.then(function () {
console.log('loaded')
})
Additional attributes
var loadScript = require('tiny-script-loader/loadScript')
var loadScriptPromised = require('tiny-script-loader/loadScriptPromised')
loadScript('https://example.com/script.js', callbackFn, { crossOrigin: true })
loadScriptPromised('https://example.com/script.js', { type: 'javascript' })
.then(fn)