node-red-contrib-netvar-utils
Version:
Network Variable List utility nodes for node-red
18 lines • 656 B
JavaScript
;
const nodeInit = (RED) => {
function NvlJsonNodeConstructor(config) {
var _a;
RED.nodes.createNode(this, config);
const nvl = (_a = RED.nodes.getNode(config.nvl)) === null || _a === void 0 ? void 0 : _a.nvl;
this.on('input', (msg, send, done) => {
if (!nvl)
return done(new TypeError('Network Variable List is not defined or invalid.'));
msg.payload = nvl.createEmptyJSON();
send(msg);
done();
});
}
RED.nodes.registerType('nvl-json', NvlJsonNodeConstructor);
};
module.exports = nodeInit;
//# sourceMappingURL=nvl-json.js.map