From a09df56a45df8e9f4e2e1ca9dafa82ba23d82f0b Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 10 Nov 2015 20:10:12 +0100 Subject: [PATCH] defined a read only property 'data' to avoid breaking the api --- lib/DataSet.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/DataSet.js b/lib/DataSet.js index 1ffadc93..25ede879 100644 --- a/lib/DataSet.js +++ b/lib/DataSet.js @@ -274,7 +274,15 @@ DataSet.prototype.update = function (data, senderId) { this._trigger('add', {items: addedIds}, senderId); } if (updatedIds.length) { - this._trigger('update', {items: updatedIds, data: updatedData}, senderId); + var props = { items: updatedIds, oldData: updatedData }; + // TODO: remove deprecated property 'data' some day + Object.defineProperty(props, 'data', { + 'get': (function() { + console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data'); + return this.get(updatedIds); + }).bind(this) + }); + this._trigger('update', props, senderId); } return addedIds.concat(updatedIds);