Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 10 days 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 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T00:30:53.000Z (about 6 years ago)
- Last Synced: 2024-09-19T01:08:43.383Z (about 2 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: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @shinin/load-script ยท [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/shiningjason/load-script/blob/master/LICENSE) [![npm](https://img.shields.io/npm/v/@shinin/load-script.svg)](https://www.npmjs.com/package/@shinin/load-script) [![Build Status](https://travis-ci.org/shiningjason/load-script.svg?branch=master)](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)