1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

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