Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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)