From d8eb80b72e0517526b853fcbe8ebcea324d20512 Mon Sep 17 00:00:00 2001 From: Kunihiko Toumura Date: Fri, 29 Nov 2019 16:43:57 +0900 Subject: [PATCH] new-style callback function (html node) --- .../@node-red/nodes/core/parsers/70-HTML.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.js b/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.js index 0a24be368..b4b58b7a8 100644 --- a/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.js +++ b/packages/node_modules/@node-red/nodes/core/parsers/70-HTML.js @@ -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);