Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shakyshane/prom-seq
Just a sequence of promises
https://github.com/shakyshane/prom-seq
Last synced: about 1 month ago
JSON representation
Just a sequence of promises
- Host: GitHub
- URL: https://github.com/shakyshane/prom-seq
- Owner: shakyShane
- Created: 2015-04-13T20:12:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-01T19:33:39.000Z (over 9 years ago)
- Last Synced: 2024-04-14T07:49:49.641Z (9 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## prom-seq [![Build Status](https://travis-ci.org/shakyShane/prom-seq.svg?branch=master)](https://travis-ci.org/shakyShane/prom-seq)
> Just a sequence of promises where each task receives
a deferred + previous value```js
import runner from 'prom-seq';
import assert from 'assert';// Async task 1
let task1 = function (deferred, previous) {
setTimeout(() => deferred.resolve(`${previous} - task 1`), 200);
};// Async task 2
let task2 = function (deferred, previous) {
setTimeout(() => deferred.resolve(`${previous} - task 2`), 200);
};// Run tasks in sequence
return runner([task1, task2], 'Initial').then((result) => {
assert.equal(result, 'Initial - task 1 - task 2');
});
```