node-red-viseo-helper
Advanced tools
Comparing version
@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct |
@@ -0,0 +0,0 @@ # Contributing to the Project |
14
index.js
@@ -16,2 +16,3 @@ 'use strict'; | ||
const mkpathsync = exports.mkpathsync = (dirpath, mode) => { | ||
@@ -189,14 +190,15 @@ dirpath = path.resolve(dirpath); | ||
class NodeEmitter extends EventEmitter {} | ||
const emitter = new NodeEmitter(); | ||
global.VBM = global.VBM || {}; | ||
global.VBM.event_emitter = global.VBM.event_emitter || new NodeEmitter(); | ||
const emitEvent = exports.emitEvent = (type, node, data, config) => { | ||
emitter.emit(type, node, data, config); | ||
global.VBM.event_emitter.emit(type, node, data, config); | ||
} | ||
const listenEvent = exports.listenEvent = (type, callback) => { | ||
emitter.addListener(type, callback); | ||
global.VBM.event_emitter.addListener(type, callback); | ||
} | ||
const removeListener = exports.removeListener = (type, callback) => { | ||
emitter.removeListener(type, callback); | ||
global.VBM.event_emitter.removeListener(type, callback); | ||
} | ||
@@ -214,7 +216,7 @@ | ||
emitter.emit(type, node, data, config); | ||
global.VBM.event_emitter.emit(type, node, data, config); | ||
} | ||
const countListeners = exports.countListeners = (type) => { | ||
let listeners = emitter.listeners(type) | ||
let listeners = global.VBM.event_emitter.listeners(type) | ||
if (!listeners){ | ||
@@ -221,0 +223,0 @@ return 0; |
@@ -0,0 +0,0 @@ const extend = require('extend'); |
{ | ||
"name" : "node-red-viseo-helper", | ||
"version" : "0.2.0-alpha.11", | ||
"version" : "0.3.0-alpha.1", | ||
"description" : "Utility libarary for Node-RED", | ||
@@ -5,0 +5,0 @@ "dependencies" : { |
@@ -0,0 +0,0 @@ # Node-RED |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
303
0.33%27252
-1.99%