remote-script
v0.2.1
Published
Programmatically Loads remote scripts via script tag
Downloads
70
Maintainers
Readme
remote-script
Programmatically Loads remote scripts via script tag.
Install
Usage
import load from 'remote-script';
/* Basic usage */
load('https://example.com/some-script.js')
.then((e) => {
if (!e) console.log('loaded');
else console.log('ErrorEvent object', e);
})
.catch((err) => {
console.log('Runtime error', err)
});
/* Async attribute */
load('https://example.com/some-script.js', { async: true })
.then(() => { /* ... */ });
.catch(() => { /* ... */ });