Skip to content

Instantly share code, notes, and snippets.

View dasheck0's full-sized avatar
:shipit:

Stefan Neidig dasheck0

:shipit:
View GitHub Profile
@jorgecuesta
jorgecuesta / sample.js
Created July 5, 2017 03:57
Hemera.js Promise support
const Hemera = require('nats-hemera');
const nats = require('nats').connect();
const hemera = new Hemera(nats, {logLevel: 'fatal'});
const actionWithPromiseSupport = function(hemera) {
const act = hemera.act;
return function(pattern, callback) {
if (callback || pattern.pubsub$) return act.call(hemera, pattern, callback);
return new Promise((resolve, reject) => {
act.call(hemera, pattern, (err, resp) => {