Skip to content

Instantly share code, notes, and snippets.

@tatat
Created March 6, 2018 07:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tatat/eeb7bda8c2ab1c3e9443e7765941ba70 to your computer and use it in GitHub Desktop.
const doAsync1 = () => client.get().then(doSomething1).catch(e => { onError1(e); throw e })
const doAsync2 = () => client.get().then(doSomething2).catch(e => { onError2(e); throw e })
const doAsync3 = () => client.get().then(doSomething3).catch(e => { onError3(e); throw e })
const doAsync4 = () => client.get().then(doSomething4).catch(e => { onError4(e); throw e })
const doAsync5 = () => client.get().then(doSomething5).catch(e => { onError5(e); throw e })
const doAsync6 = () => client.get().then(doSomething6).catch(e => { onError6(e); throw e })
const doAsyncSerial = () => doAsync1().then(() => doAsync2()).then(() => doAsync2()).then(doSomethingSerial).catch(e => { onErrorSerial(e); throw e })
const doAsyncParallel = () => Promise.all([doAsync4, doAsync5, doAsync6]).then(doSomethingParallel).catch(e => { onErrorParallel(e); throw e })
const doAsync = () => doAsyncSerial().then(doAsyncParallel)
doAsync().then(doSomething).catch(e => onError(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment