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

Remove unnecessary call to clientRemoveListeners

Also, merge the non JSDOC comment into the JSDOC comment
This commit is contained in:
Stephen McLaughlin 2022-05-09 16:37:25 +01:00 committed by Steve-Mcl
parent 2ded07c765
commit e7f6549cb6

View File

@ -922,19 +922,14 @@ module.exports = function(RED) {
node.on('close', function(done) { node.on('close', function(done) {
node.disconnect(function() { node.disconnect(function() {
if(node.client) {
node._clientRemoveListeners();
}
done(); done();
}); });
}); });
// Helper functions to track the event listners we add to the
// client. The mqtt client also uses it own set of listeners
// so we can't use removeAllListeners() wothout breaking it
/** /**
* Add an event handler to the MQTT.js client * Add event handlers to the MQTT.js client and track them so that
* we do not remove any handlers that the MQTT client uses internally.
* Use {@link node._clientRemoveListeners `node._clientRemoveListeners`} to remove handlers
* @param {string} event The name of the event * @param {string} event The name of the event
* @param {function} handler The handler for this event * @param {function} handler The handler for this event
*/ */