Promise support for Seneca.js microservices
seneca-as-promised
- Lead Maintainer: Denis Luchkin-Zhou
- Sponsor: Ricepo
This plugin adds support for promises to Seneca, courtesy of Bluebird.
Install
To install, use npm
npm install seneca-as-promised
Add in your code
;
API
addAsync()
Behaves exactly like seneca.add()
, but supports promise-returning functions.
seneca;
Actions added via addAsync()
have an additional priorAsync
method in the
this
context, which is a promisified version of this.prior()
.
actAsync()
Behaves exactly like seneca.act()
, but returns a promise. Also supports
callbacks.
const color = await seneca;
wrapAsync()
Behaves exactly like seneca.wrap()
, but supports promise-returning functions.
seneca;
Wrappers added via wrapAsync()
have an additional priorAsync
method in the
this
context, which is a promisified version of this.prior()
.
License
Copyright (C) 2015-16, Denis Luchkin-Zhou. Licensed under MIT