Update packages/node_modules/@node-red/nodes/core/network/10-mqtt.js

Co-authored-by: Stephen McLaughlin <44235289+Steve-Mcl@users.noreply.github.com>
This commit is contained in:
Phil Day 2022-05-09 16:20:44 +01:00 committed by GitHub
parent 98d524e82d
commit 82672a825d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -1024,15 +1024,14 @@ module.exports = function(RED) {
* * If `handler` is omitted, then all events named `event` are removed
* * If both parameters are omitted, then all events are removed
* @param {string} [event] The name of the event (optional)
* @param {function} [handler] The handler for this event
* @param {function} [handler] The handler for this event (optional)
*/
node._clientRemoveListeners = function(event, handler) {
node.clientListeners = node.clientListeners.filter((l) => {
if (event && event !== l.e) { return true; }
if (handler && handler !== l.h) { return true; }
node.client.removeListener(l.event, l.f)
return false; //found and removed, fliter out this one
if (event && event !== l.event) { return true; }
if (handler && handler !== l.handler) { return true; }
node.client.removeListener(l.event, l.handler)
return false; //found and removed, filter out this one
})
}