mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add send to input handler signature
This commit is contained in:
@@ -81,7 +81,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
|
||||
this.on("input", function(msg, done) {
|
||||
this.on("input", function(msg, send, done) {
|
||||
if (this.complete === "true") {
|
||||
// debug complete msg object
|
||||
if (this.console === "true") {
|
||||
|
@@ -328,12 +328,12 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
this.on('input', function(msg, done) {
|
||||
this.on('input', function(msg, send, done) {
|
||||
applyRules(msg, 0, (err,msg) => {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
} else if (msg) {
|
||||
node.send(msg);
|
||||
send(msg);
|
||||
}
|
||||
done();
|
||||
})
|
||||
|
@@ -137,7 +137,11 @@ Node.prototype._emitInput = function(arg) {
|
||||
var node = this;
|
||||
if (node._inputCallback) {
|
||||
try {
|
||||
node._inputCallback(arg,function(err) { node._complete(arg,err); });
|
||||
node._inputCallback(
|
||||
arg,
|
||||
function() { node.send.apply(node,arguments) },
|
||||
function(err) { node._complete(arg,err); }
|
||||
);
|
||||
} catch(err) {
|
||||
node.error(err,arg);
|
||||
}
|
||||
@@ -149,12 +153,16 @@ Node.prototype._emitInput = function(arg) {
|
||||
c++;
|
||||
}
|
||||
try {
|
||||
node._inputCallbacks[i](arg,function(err) {
|
||||
c--;
|
||||
if (c === 0) {
|
||||
node._complete(arg,err);
|
||||
node._inputCallbacks[i](
|
||||
arg,
|
||||
function() { node.send.apply(node,arguments) },
|
||||
function(err) {
|
||||
c--;
|
||||
if (c === 0) {
|
||||
node._complete(arg,err);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
} catch(err) {
|
||||
node.error(err,msg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user