@hypericon/node-red-hypertable
Version:
Node-RED plugin to interact with Hypertable
40 lines (26 loc) • 975 B
JavaScript
// https://nodered.org/docs/creating-nodes/node-js
const nodeInit = (RED) => {
function hypertableConnectionNode(config) {
RED.nodes.createNode(this, config);
// This is required to make the configured values available to other nodes
this.name = config.name;
this.baseUrl = config.baseUrl;
this.projectId = config.projectId;
// this.workspaceId = config.workspaceId;
this.apiKey = config.apiKey;
// Called whenever a message arrives at the node
this.on('input', (msg, send, done) => {
// Sends the message to following Nodes
this.send(msg);
});
// Tidy up state on redeploying flows
this.on('close', function(done) {
// tidy up any state
// Call done() after async work
done();
});
}
// Register the configured Node wih Node-RED
RED.nodes.registerType("hypertable-connection", hypertableConnectionNode);
}
module.exports = nodeInit;