An async script loader, for the browser, built on Promises.
JavaScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.babelrc
.eslintrc
.gitignore
.npmignore
README.md
package.json
rollup.config.js

README.md

xec

xec on NPM

An async script loader, for the browser, built on Promises.

Pronounced "exec".

Install

npm i xec --save

API

xec exposes the following API:

.one(source)

import { one } from 'xec'

one('path/one.js')
  .then(() => console.log('Script loaded and executed.'))
  .catch(() => console.log('Something went wrong.'))

.many(sources)

import { many } from 'xec'

const sources = [
  'path/one.js',
  'path/two.js'
]

many(sources)
  .then(() => console.log('All scripts loaded and executed.'))
  .catch(() => console.log('Something went wrong.'))

Browser Support

  1. Async script loading requires async attribute support.
  2. Promises are required. If needed, polyfill them.

License

MIT. © 2016 Michael Cavalea