Skip to content

Commit a981d02

Browse files
committed
Fixed the way to provide default empty function.
Default paramter is introduced since ES6. Replaced the way that supports older ES,
1 parent aa5647d commit a981d02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/client.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ default:
953953
954954
for now i just suppressed the warnings
955955
*/
956-
MqttClient.prototype._handlePublish = function (packet, done = function () {}) {
956+
MqttClient.prototype._handlePublish = function (packet, done) {
957+
done = typeof done !== 'undefined' ? done : function () {}
957958
var topic = packet.topic.toString()
958959
var message = packet.payload
959960
var qos = packet.qos
@@ -1076,7 +1077,8 @@ MqttClient.prototype._handleAck = function (packet) {
10761077
* @param {Object} packet
10771078
* @api private
10781079
*/
1079-
MqttClient.prototype._handlePubrel = function (packet, callback = function () {}) {
1080+
MqttClient.prototype._handlePubrel = function (packet, callback) {
1081+
callback = typeof callback !== 'undefined' ? callback : function () {}
10801082
var mid = packet.messageId
10811083
var that = this
10821084

0 commit comments

Comments
 (0)