Remove observablePropertyCounter to help avoid accumulating garbage on prop redefinition
This commit is contained in:
parent
f3631ed18f
commit
e2575c3ea1
|
@ -10,7 +10,6 @@ function Graph() {
|
||||||
this.damagedNodes = Immutable.Set();
|
this.damagedNodes = Immutable.Set();
|
||||||
this.currentSubjectId = null;
|
this.currentSubjectId = null;
|
||||||
this.enforceSubjectPresence = true;
|
this.enforceSubjectPresence = true;
|
||||||
this.observablePropertyCounter = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Graph.prototype.withSubject = function (subjectId, f) {
|
Graph.prototype.withSubject = function (subjectId, f) {
|
||||||
|
@ -81,7 +80,7 @@ Graph.prototype.repairDamage = function (repairNode) {
|
||||||
Graph.prototype.defineObservableProperty = function (obj, prop, value, maybeOptions) {
|
Graph.prototype.defineObservableProperty = function (obj, prop, value, maybeOptions) {
|
||||||
var graph = this;
|
var graph = this;
|
||||||
var options = typeof maybeOptions === 'undefined' ? {} : maybeOptions;
|
var options = typeof maybeOptions === 'undefined' ? {} : maybeOptions;
|
||||||
var objectId = '__' + (options.baseId || prop) + '_' + (graph.observablePropertyCounter++);
|
var objectId = '__' + (options.baseId || prop);
|
||||||
Object.defineProperty(obj, prop, {
|
Object.defineProperty(obj, prop, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
|
|
Loading…
Reference in New Issue