Skip to content

Commit

Permalink
replace bind with closure
Browse files Browse the repository at this point in the history
  • Loading branch information
behrad committed Jul 14, 2017
1 parent fc27c3c commit e459231
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ CachedPersistence.prototype._addedSubscriptions = function (client, subs, cb) {
topic: newSubTopic,
brokerPublish: brokerPublish
}
ctx.brokerPublish(subs, addedSubDone.bind(ctx))
ctx.brokerPublish(subs, function () {
cb(null, client)
})
}

function qosGreaterThanOne (sub) {
Expand All @@ -104,10 +106,6 @@ function brokerPublish (subs, cb) {
this.broker.publish(packet, cb)
}

function addedSubDone () {
this.cb(null, this.client)
}

function noop () {}

CachedPersistence.prototype._removedSubscriptions = function (client, subs, cb) {
Expand All @@ -118,7 +116,9 @@ CachedPersistence.prototype._removedSubscriptions = function (client, subs, cb)
topic: rmSubTopic,
brokerPublish: brokerPublish
}
ctx.brokerPublish(subs, addedSubDone.bind(ctx))
ctx.brokerPublish(subs, function () {
cb(null, client)
})
}

CachedPersistence.prototype.subscriptionsByTopic = function (topic, cb) {
Expand Down

0 comments on commit e459231

Please sign in to comment.