Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Node.prototype.send = function(msg: any) {
Node.prototype._send.call(this, msg)
if (!me.status.debugOut) return
const _data = {
id: this.id,
z: this.z,
name: this.name,
topic: msg.topic,
msg: msg,
_path: msg._path
}
const data = RED.runtime.util.encodeObject(_data);
RED.runtime.events.emit("comms", {
topic: "debug",
data: data,
retain: false
})
}
}
Node.prototype.send = function(msg: any) {
Node.prototype._send.call(this, msg)
if (!me.status.debugOut) return
const _data = {
id: this.id,
z: this.z,
name: this.name,
topic: msg.topic,
msg: msg,
_path: msg._path
}
const data = RED.runtime.util.encodeObject(_data);
RED.runtime.events.emit("comms", {
topic: "debug",
data: data,
retain: false
})
}
}
private async addModule(pkgname: string) {
try {
const info: {nodes: any} = await registry.addModule(pkgname);
RED.runtime.events.emit("runtime-event", {
id: "node/added",
payload: info.nodes,
retain: false
});
} catch (err) {
if (err.code === "module_already_loaded") {
this.error(err, `${pkgname} already loaded`);
return;
}
if (err.code !== "MODULE_NOT_FOUND") throw err;
this.success(`${pkgname} installed`);
}
}