Browse Source

defined a read only property 'data' to avoid breaking the api

fixDataView
Martin Fischer 8 years ago
parent
commit
a09df56a45
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      lib/DataSet.js

+ 9
- 1
lib/DataSet.js View File

@ -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);

Loading…
Cancel
Save