remote-script
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

remote-script

Version Build Status Coverage Dependencies Vulnerabilities License Types

Programmatically Loads remote scripts via script tag.

Install

npm install remote-script

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(() => { /* ... */ });

Package Sidebar

Install

npm i remote-script

Weekly Downloads

15

Version

0.2.1

License

MIT

Unpacked Size

16.3 kB

Total Files

12

Last publish

Collaborators

  • rafamel