diff --git a/packages/livedata/livedata_connection.js b/packages/livedata/livedata_connection.js index 9d5918ce89..9ecd99237e 100644 --- a/packages/livedata/livedata_connection.js +++ b/packages/livedata/livedata_connection.js @@ -935,6 +935,7 @@ _.extend(Meteor._LivedataConnection.prototype, { }, _pushUpdate: function (updates, collection, msg) { + var self = this; if (!_.has(updates, collection)) { updates[collection] = []; } @@ -1050,6 +1051,7 @@ _.extend(Meteor._LivedataConnection.prototype, { }, _process_complete: function (msg, updates) { + var self = this; // Process "sub ready" messages. "sub ready" messages don't take effect // until all current server documents have been flushed to the local // database. We can use a write fence to implement this. diff --git a/packages/livedata/livedata_server.js b/packages/livedata/livedata_server.js index 59accd718c..6f3fd2817e 100644 --- a/packages/livedata/livedata_server.js +++ b/packages/livedata/livedata_server.js @@ -704,7 +704,8 @@ _.extend(Meteor._LivedataSubscription.prototype, { }, onStop: function (callback) { - this._stopCallbacks.push(callback); + var self = this; + self._stopCallbacks.push(callback); }, added: function (collectionName, id, fields) { @@ -714,10 +715,12 @@ _.extend(Meteor._LivedataSubscription.prototype, { }, changed: function (collectionName, id, fields) { + var self = this; self._session.changed(self._subscriptionId, collectionName, id, fields); }, removed: function (collectionName, ids) { + var self = this; _.each(ids, function(id) { // we don't bother to delete sets of things in a collection if the // collection is empty. It could break below, where we iterate over