1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

new-style callback function (link in/out node)

This commit is contained in:
Kunihiko Toumura 2019-11-29 09:45:12 +09:00
parent 3f4de43b67
commit 2e19bc07df

View File

@ -26,8 +26,9 @@ module.exports = function(RED) {
node.receive(msg); node.receive(msg);
} }
RED.events.on(event,handler); RED.events.on(event,handler);
this.on("input", function(msg) { this.on("input", function(msg, send, done) {
this.send(msg); send(msg);
done();
}); });
this.on("close",function() { this.on("close",function() {
RED.events.removeListener(event,handler); RED.events.removeListener(event,handler);
@ -40,10 +41,11 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
var node = this; var node = this;
var event = "node:"+n.id; var event = "node:"+n.id;
this.on("input", function(msg) { this.on("input", function(msg, send, done) {
msg._event = event; msg._event = event;
RED.events.emit(event,msg) RED.events.emit(event,msg)
this.send(msg); send(msg);
done();
}); });
} }
RED.nodes.registerType("link out",LinkOutNode); RED.nodes.registerType("link out",LinkOutNode);