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 GitHub
parent a0f7e92e40
commit e223b20cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 8 deletions

View File

@ -1005,19 +1005,14 @@ module.exports = function(RED) {
node.on('close', function(done) {
node.disconnect(function() {
if(node.client) {
node._clientRemoveListeners();
}
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 {function} handler The handler for this event
*/