@promises/forever
v0.5.0
Published
Forever is package from Promises library
Downloads
20
Maintainers
Readme
@promises/forever
Forever is package from Promises library
Use
Module
$ npm install --save @promises/forever
import {
default as forever
} from '@promises/forever';
Browser
<script src="https://unpkg.com/@promises/forever/bundle.umd.min.js"></script>
let {
forever
} = P;
Examples
forever((count: number) => new Promise((resolve, reject) => {
setImmediate(() => {
count >= 5 ? reject('foo') : resolve(++count);
});
}), 0).catch((error: string) => {
console.log(error); // error => 'reject'
});
Wrapper
Module
$ npm install --save @promises/forever
import Promises from '@promises/core';
import '@promises/forever/add';
Or
import Promises from '@promises/forever/add';
Browser
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/forever/add/bundle.umd.min.js"></script>
let {
Promises
} = P;
Examples
Promises.forever((count: number) => new Promise((resolve, reject) => {
setImmediate(() => {
count >= 5 ? reject('foo') : resolve(++count);
});
}), 0).catch((error: string) => {
console.log(error) // error => 'reject'
});
Compatibility
These modules are written in typescript and available in ES5 and ES6 standard, the requirements are a global Promise (native or polyfill).
License
Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.