Add _initializeProtoProperties as an override in PropertyAccessrs, overridden in PropertyEffects.

This commit is contained in:
Steven Orvell 2017-02-14 16:59:19 -08:00
parent c7dc0fefb6
commit eb3f26c15e
2 changed files with 17 additions and 8 deletions

View File

@ -77,7 +77,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
static createPropertiesForAttributes() {
let a$ = this.observedAttributes;
for (let i=0; i < a$.length; i++) {
this._createPropertyAccessor(caseMap.dashToCamelCase(a$[i]));
this.prototype._createPropertyAccessor(caseMap.dashToCamelCase(a$[i]));
}
}
@ -109,14 +109,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this.__dataCounter = 0;
this.__dataInvalid = false;
// initialize data with prototype values saved when creating accessors
this.__data = {};
this.__dataPending = null;
this.__dataOld = null;
if (this.__dataProto) {
this.__data = Object.create(this.__dataProto);
this.__dataPending = Object.create(this.__dataProto);
this.__dataOld = {};
} else {
this.__data = {};
this.__dataPending = null;
this.__dataOld = null;
this._initializeProtoProperties(this.__dataProto);
}
}
_initializeProtoProperties(props) {
for (let p in props) {
this._setProperty(p, props[p]);
}
}

View File

@ -1218,6 +1218,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
_initializeProtoProperties(props) {
this.__data = Object.create(props);
this.__dataPending = Object.create(props);
this.__dataOld = {};
}
// Prototype setup ----------------------------------------
/**