diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/Node.js b/packages/node_modules/@node-red/runtime/lib/nodes/Node.js index 7a7445a92..5a60cf6a0 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/Node.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/Node.js @@ -42,6 +42,7 @@ function Node(n) { this._closeCallbacks = []; this._inputCallback = null; this._inputCallbacks = null; + this._expectedDoneCount = 0; if (n.name) { this.name = n.name; @@ -159,6 +160,9 @@ Node.prototype.on = function(event, callback) { if (event == "close") { this._closeCallbacks.push(callback); } else if (event === "input") { + if (callback.length === 3) { + this._expectedDoneCount++ + } if (this._inputCallback) { this._inputCallbacks = [this._inputCallback, callback]; this._inputCallback = null; @@ -218,19 +222,17 @@ Node.prototype._emitInput = function(arg) { } else if (node._inputCallbacks) { // Multiple callbacks registered. Call each one, tracking eventual completion var c = node._inputCallbacks.length; + let doneCount = 0 for (var i=0;i