first commit
This commit is contained in:
commit
aa7869eb33
386 files changed
+69375
No files matched your search
@@ -0,0 +1,24 @@
|
||||
// Small plugin that subscribes to some events, stores
|
||||
// them and sends it to the parent process.
|
||||
|
||||
const log = require('../core/log');
|
||||
const _ = require('lodash');
|
||||
const subscriptions = require('../subscriptions');
|
||||
const config = require('../core/util').getConfig();
|
||||
|
||||
const ChildToParent = function() {
|
||||
|
||||
subscriptions
|
||||
// .filter(sub => config.childToParent.events.includes(sub.event))
|
||||
.forEach(sub => {
|
||||
this[sub.handler] = (event, next) => {
|
||||
process.send({type: sub.event, payload: event});
|
||||
if(_.isFunction(next)) {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
}
|
||||
|
||||
module.exports = ChildToParent;
|
||||
Reference in new issue
Block a user