Options
All
  • Public
  • Public/Protected
  • All
Menu

remote-script 0.2.1

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

Generated using TypeDoc