How to use the node-red.runtime function in node-red

To help you get started, we’ve selected a few node-red examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sakazuki / node-red-desktop / src / main / node-red.ts View on Github external
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
      })
    }
  }
github sakazuki / node-red-desktop / src / main / node-red.ts View on Github external
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
      })
    }
  }
github sakazuki / node-red-desktop / src / main / node-red.ts View on Github external
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`);
    }
  }