dynamic-script
Extremely simple dynamic script loader with promise API
Companion to dynamic-style
Goals
- Simple and readable source code
- Small API
- Fully tested
Install
$ npm install dynamic-script
Usage
const loadScript = // url is set as <script src="${url}"> // resolves with the appended script elementconst elem = await elemsrc // https://url.com/script.js
Configure by passing a script element. It will be used instead of creating a new element.
const scriptTag = documentscriptTagasync = false await