xec

0.1.0 • Public • Published

xec

xec on NPM

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

Pronounced "exec".

Install

npm i xec --save

API

xec exports a singleton, and won't load the same source twice.

It 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. © 2017 Michael Cavalea

Package Sidebar

Install

npm i xec

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • callmecavs