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 (html node)

This commit is contained in:
Kunihiko Toumura 2019-11-29 16:43:57 +09:00
parent 4f3a6821d1
commit d8eb80b72e

View File

@ -26,7 +26,7 @@ module.exports = function(RED) {
this.ret = n.ret || "html";
this.as = n.as || "single";
var node = this;
this.on("input", function(msg) {
this.on("input", function(msg,send,done) {
var value = RED.util.getMessageProperty(msg,node.property);
if (value !== undefined) {
var tag = node.tag;
@ -57,7 +57,7 @@ module.exports = function(RED) {
type: "string",
ch: ""
};
node.send(new_msg);
send(new_msg);
}
}
if (node.as === "single") {
@ -70,14 +70,15 @@ module.exports = function(RED) {
});
if (node.as === "single") { // Always return an array - even if blank
RED.util.setMessageProperty(msg,node.outproperty,pay);
node.send(msg);
send(msg);
}
done();
}
catch (error) {
node.error(error.message,msg);
done(error.message);
}
}
else { node.send(msg); } // If no payload - just pass it on.
else { send(msg); done(); } // If no payload - just pass it on.
});
}
RED.nodes.registerType("html",CheerioNode);