Skip to content

Commit

Permalink
allow ack and nack to be destructured (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
baronfel authored and callmehiphop committed Feb 9, 2018
1 parent 4433ac8 commit ace59b0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/connection-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ ConnectionPool.prototype.createMessage = function(connectionId, resp) {
var milliseconds = parseInt(pt.nanos, 10) / 1e6;
var originalDataLength = resp.message.data.length;

return {
var message = {
connectionId: connectionId,
ackId: resp.ackId,
id: resp.message.messageId,
Expand All @@ -300,13 +300,14 @@ ConnectionPool.prototype.createMessage = function(connectionId, resp) {
get length() {
return originalDataLength;
},
ack: function() {
self.subscription.ack_(this);
},
nack: function() {
self.subscription.nack_(this);
},
};
message.ack = function() {
self.subscription.ack_(message);
};
message.nack = function() {
self.subscription.nack_(message);
};
return message;
};

/*!
Expand Down

0 comments on commit ace59b0

Please sign in to comment.