step-by-step
A simple way to execute a group of ES6 promises in a synchronous manner.
How to use
In this example a synthetic Promise
is used to show how runSync
works.
The input array for runSync should contain functions which return the Promises that will be executed in a synchronous way.
const runSync = runSync; const createPromise = { return { return { const planet stopFor = param; ; }; };}; const promiseArray = ; // Output: Mercury, Venus, Earth, Marsconst results = ; // Output: [ 'Mercury', 'Venus', 'Earth', 'Mars' ]results;
Looks a bit bulky? If all the promise factory related stuff is left out it looks way cleaner:
const runSync = runSync; const promises = ; ;
Changelog
1.0.8
- updated dev dependencies1.0.6
- changed typings1.0.4
- fix wrong export 😀1.0.2
- add typings see #1