Skip to content

Instantly share code, notes, and snippets.

@timwis
Created December 18, 2016 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timwis/e0d6e59bbf272f65a681bac51a2eb1a7 to your computer and use it in GitHub Desktop.
Save timwis/e0d6e59bbf272f65a681bac51a2eb1a7 to your computer and use it in GitHub Desktop.
Use promises and async/await in effects in choo
app.use({
wrapEffects: (cb) => {
return async (state, data, send, done) => {
const psend = promisify(send)
try {
await cb(state, data, psend)
done()
} catch (err) {
done(err)
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment