Skip to content

Instantly share code, notes, and snippets.

@nijikokun
Last active August 29, 2015 14:17
Show Gist options
  • Save nijikokun/561ddc573cee4ffc14a5 to your computer and use it in GitHub Desktop.
Save nijikokun/561ddc573cee4ffc14a5 to your computer and use it in GitHub Desktop.
Async flow for ES5/6 (Purely thought / psuedocode)
flo = flow
// Add method signature and arguments to be invoked
.add(/* [name, ]function[, arguments...] */)
// Attach thenable to previous method signature
.then(function () {
// skip(/* string name | int groups */)
flo.skip('name') // this.skip vs flo.skip vs (skip argument on argument list, after next)
// next(/* string name | int group */)
// sugar for #jump(/* string name | int group */)
flo.next() // this.next vs flo.next vs (next argument on argument list)
})
// Add another grouping
.add('name', request, args)
.then(/* function(args...) */)
// Un-attached thenable, invoked if everything goes okay
// #skip('global') to skip
.then(...)
.catch(/* [ErrorType, ]function(args...) */)
.finally(/* function args(...) */)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment