UNPKG

@logiccloud/node-red-logiccloud-control

Version:

The all-in-one logiccloud control package for Node-RED environment.

35 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const main_1 = require("../helper/main"); const main_2 = require("../helper/main"); module.exports = function (RED) { function LogiccloudControlConfiguration(config) { RED.nodes.createNode(this, config); this.host = config.host; this.port = config.port; if (this.host && this.port) { this.log(`LogiccloudControlConfiguration, starting connection to logiccloud control on ${this.host}:${this.port}`); const settings = { host: this.host, port: this.port }; const connector = new main_1.ConnectionWrapper(settings); connector.events.on('onListInputs', (inputs) => tslib_1.__awaiter(this, void 0, void 0, function* () { (0, main_2.setInputVariables)(this.port, inputs); })); connector.events.on('onListOutputs', (outputs) => tslib_1.__awaiter(this, void 0, void 0, function* () { (0, main_2.setOutputVariables)(this.port, outputs); })); this.connector = connector; connector.start(); this.log(`LogiccloudControlConfiguration, connection to logiccloud control started on ${this.host}:${this.port}`); this.on("close", () => { this.log('LogiccloudControlConfiguration, close'); connector.stop(); }); } } RED.nodes.registerType("logiccloud-control-configuration", LogiccloudControlConfiguration); }; //# sourceMappingURL=logiccloud-control-configuration.js.map