resolve-bus-zmq
Advanced tools
Comparing version 0.0.1-alpha.79f28edb to 0.0.2-alpha.5e5cbe56
@@ -7,36 +7,2 @@ 'use strict'; | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
var _stringify2 = _interopRequireDefault(_stringify); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
exports.default = function (options) { | ||
var handler = function handler() {}; | ||
var config = (0, _assign2.default)({}, defaultOptions, options); | ||
var initPromise = init(config, function (event) { | ||
return handler(event); | ||
}); | ||
return { | ||
publish: function publish(event) { | ||
return initPromise.then(function (_ref4) { | ||
var publisher = _ref4.publisher; | ||
return publisher((0, _stringify2.default)(event)); | ||
}); | ||
}, | ||
setTrigger: function setTrigger(callback) { | ||
return initPromise.then(function () { | ||
return handler = callback; | ||
}); | ||
} | ||
}; | ||
}; | ||
var _zeromq = require('zeromq'); | ||
@@ -108,3 +74,3 @@ | ||
function init(options, trigger) { | ||
return _promise2.default.resolve().then(function () { | ||
return Promise.resolve().then(function () { | ||
return runBroker(options); | ||
@@ -119,2 +85,27 @@ }).catch(function (err) { | ||
}); | ||
} | ||
} | ||
function createDriver(options) { | ||
var handler = function handler() {}; | ||
var config = Object.assign({}, defaultOptions, options); | ||
var initPromise = init(config, function (event) { | ||
return handler(event); | ||
}); | ||
return { | ||
publish: function publish(event) { | ||
return initPromise.then(function (_ref4) { | ||
var publisher = _ref4.publisher; | ||
return publisher(JSON.stringify(event)); | ||
}); | ||
}, | ||
setTrigger: function setTrigger(callback) { | ||
return initPromise.then(function () { | ||
return handler = callback; | ||
}); | ||
} | ||
}; | ||
} | ||
exports.default = createDriver; | ||
module.exports = exports['default']; |
{ | ||
"name": "resolve-bus-zmq", | ||
"version": "0.0.1-alpha.79f28edb", | ||
"version": "0.0.2-alpha.5e5cbe56", | ||
"description": "This package is a driver for resolve-bus to emit events using ZeroMQ.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4150
89