Basic EVOLV setup

This commit is contained in:
2025-07-23 14:46:03 +02:00
parent 79e0d0678a
commit f70fa15ef5
5 changed files with 228 additions and 23 deletions

View File

@@ -1,6 +1,26 @@
const nameOfNode = "liquidFlowHandler";
const nodeClass = require('./src/nodeClass.js');
const { MenuManager } = require('generalFunctions');
module.exports = function(RED) {
function liquidFlowHandler(config) {
RED.nodes.createNode(this, config);
// 1) Register the node type and delegate to your class
RED.nodes.registerType(nameOfNode, function(config) {
RED.nodes.createNode(this, config);
this.nodeClass = new nodeClass(config, RED, this, nameOfNode);
});
// 2) Setup the dynamic menu endpoint
const menuMgr = new MenuManager();
// Serve /liquidFlowHandler/menu.js
RED.httpAdmin.get(`/${nameOfNode}/menu.js`, (req, res) => {
try {
const script = menuMgr.createEndpoint(nameOfNode, ['logger']);
res.type('application/javascript').send(script);
} catch (err) {
res.status(500).send(`// Error generating menu: ${err.message}`);
}
RED.nodes.registerType("liquidFlowHandler", liquidFlowHandler);
};
});
};