Skip to content

Instantly share code, notes, and snippets.

@webpapaya
Last active November 16, 2016 09:20
Show Gist options
  • Save webpapaya/9fd42a7234b57688c6a0553e7f7d32ad to your computer and use it in GitHub Desktop.
Save webpapaya/9fd42a7234b57688c6a0553e7f7d32ad to your computer and use it in GitHub Desktop.
import { queue, retry } from 'promise-frites';
const myApiCall1 = () => Promise.resolve()
.then(() => { /* call server */ })
.then(() => { /* notify user */})
.then(() => { /* call server again */ })
.then(() => { /* notify user again */});
const myApiCall2 = () => Promise.resolve()
.then(() => { /* call server */ })
.then(() => { /* notify user */});
Promise.resolve()
.then(queue(...[myApiCall1, myApiCall2]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment