x-promise
v1.2.0
Published
The library extends the functionality of native promises
Downloads
5
Readme
x-promise
The library extends the functionality of native promises It's not polyfill!ES5 compatible
Installation
npm install x-promise
Using
In node/browserify/webpack:
require('x-promise')
No-conflict version, for use in other libraries
const XPromise = require('x-promise/no-conflict')();
//or with any polyfill
const XMyPromise = require('x-promise/no-conflict')(MyPromise);
In browser (without module system): copy x-promise.min.js to your public directory
<!-- optional, for old browsers -->
<script src="//cdn.polyfill.io/v2/polyfill.min.js"></script>
<script src="/path/to/x-promise.min.js"></script>
Added functionality
- Promise.defer()
- Promise.callback()
- Promise.props(dictionary)
- Promise.attempt(function())
- Promise.delay([milliseconds])
- promiseInstanse.delay([milliseconds])
- promiseInstanse.timeout(milliseconds[, errorInstanse | (string) message])
- promiseInstanse.spread(function(...values))
- promiseInstanse.tap(function(value))
- Promise.map(array, function(value, index, array))
- promiseInstanse.map(function(value, index, array))
- promiseInstanse.reduce(function(previousValue, currentValue, index, array)[, initialValue])
- Promise.fnwrap(function(resolve, reject, ...args))
- Promise.coroutine(function*(...args))