Skip to content

Instantly share code, notes, and snippets.

@tKe
Created June 23, 2016 12:47
Show Gist options
  • Save tKe/c3a51f4fa268a639ed94ef5ca6095158 to your computer and use it in GitHub Desktop.
Save tKe/c3a51f4fa268a639ed94ef5ca6095158 to your computer and use it in GitHub Desktop.
Example of broken promisifying of seneca.act from within a plugin
"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