The purpose of this library is to be the smallest callback & Promise -based script loader.
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)