24 lines
584 B
JavaScript
24 lines
584 B
JavaScript
module.exports = function(RED) {
|
|
function reactor(config) {
|
|
RED.nodes.createNode(this, config);
|
|
var node = this;
|
|
|
|
let name = config.name;
|
|
|
|
const Reactor = require('./dependencies/reactor_class');
|
|
|
|
const reactor = new Reactor(Array(13).fill(0.001));
|
|
|
|
node.on('input', function(msg, send, done) {
|
|
if (msg.topic == "clock") {
|
|
reactor.updateState(msg);
|
|
}
|
|
|
|
if (done) {
|
|
done();
|
|
}
|
|
});
|
|
}
|
|
RED.nodes.registerType("advanced-reactor", reactor);
|
|
};
|