Created
June 23, 2016 12:47
-
-
Save tKe/c3a51f4fa268a639ed94ef5ca6095158 to your computer and use it in GitHub Desktop.
Example of broken promisifying of seneca.act from within a plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const Promise = require('bluebird'); | |
require('seneca')() | |
.use(function testPlugin(options) { | |
const seneca = this; | |
const act = Promise.promisify(seneca.act, seneca); | |
seneca.add("cmd:test", (args, done) => { | |
act("cmd:log", {msg: "hello world"}) | |
.then(r => done(null, r)) | |
.catch(e => done(e)) | |
}); | |
}) | |
.add("cmd:log", (args, done) => { | |
console.log(args.msg); | |
done(); | |
}) | |
.act("cmd:test"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment