https://github.com/shiningjason/load-script
๐ซ A simple async script loader for modern browsers.
https://github.com/shiningjason/load-script
async browser javascript load-js load-script npm-package promise
Last synced: 9 months ago
JSON representation
๐ซ A simple async script loader for modern browsers.
- Host: GitHub
- URL: https://github.com/shiningjason/load-script
- Owner: shiningjason
- License: mit
- Created: 2018-11-11T13:42:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T00:30:53.000Z (about 7 years ago)
- Last Synced: 2025-03-18T06:01:39.897Z (10 months ago)
- Topics: async, browser, javascript, load-js, load-script, npm-package, promise
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@shinin/load-script
- Size: 52.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @shinin/load-script ยท [](https://github.com/shiningjason/load-script/blob/master/LICENSE) [](https://www.npmjs.com/package/@shinin/load-script) [](https://travis-ci.org/shiningjason/load-script)
`@shinin/load-script` is a simple async script loader for modern browsers.
### 3 seconds quick view
```js
import loadScript from '@shinin/load-script'
export default async function loadSDK() {
await loadScript('http://foo.bar/sdk.js')
// Now, you can do what you want after SDK.js has loaded...
}
```
## Installation
```
npm install @shinin/load-script --save
```
Also you can use `@shinin/load-script` as a `` tag from a [CDN](https://unpkg.com/@shinin/load-script/dist/load-script.min.js).
```html
<!-- Use promise-polyfill only if you want to support old browsers. -->
<!-- <script src="https://unpkg.com/promise-polyfill"> -->
```
## Browser Support
- Chrome
- Firefox
- Safari 7.1+
- Safari 5.1+ (with [promises-polyfill](https://github.com/taylorhakes/promise-polyfill))
- IE 8+ (with [promises-polyfill](https://github.com/taylorhakes/promise-polyfill))
## License
[MIT](https://github.com/shiningjason/load-script/blob/master/LICENSE)