mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
provides support for memoizing pathFn on effect;
only process effects/listeners if they exist.
This commit is contained in:
parent
d93340a209
commit
a2376b6e95
@ -14,10 +14,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
_dataEventCache: {},
|
||||
|
||||
// for prototypes (usually)
|
||||
|
||||
prepareModel: function(model) {
|
||||
model._propertyEffects = {};
|
||||
model._bindListeners = [];
|
||||
Polymer.Base.mixin(model, this._modelApi);
|
||||
},
|
||||
|
||||
@ -106,6 +103,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// a prepared model can acquire effects
|
||||
|
||||
ensurePropertyEffects: function(model, property) {
|
||||
if (!model._propertyEffects) {
|
||||
model._propertyEffects = {};
|
||||
}
|
||||
var fx = model._propertyEffects[property];
|
||||
if (!fx) {
|
||||
fx = model._propertyEffects[property] = [];
|
||||
@ -115,11 +115,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
addPropertyEffect: function(model, property, kind, effect) {
|
||||
var fx = this.ensurePropertyEffects(model, property);
|
||||
fx.push({
|
||||
var propEffect = {
|
||||
kind: kind,
|
||||
effect: effect,
|
||||
fn: Polymer.Bind['_' + kind + 'Effect']
|
||||
});
|
||||
};
|
||||
fx.push(propEffect);
|
||||
return propEffect;
|
||||
},
|
||||
|
||||
createBindings: function(model) {
|
||||
@ -193,6 +195,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
},
|
||||
|
||||
_addAnnotatedListener: function(model, index, property, path, event) {
|
||||
if (!model._bindListeners) {
|
||||
model._bindListeners = [];
|
||||
}
|
||||
var fn = this._notedListenerFactory(property, path,
|
||||
this._isStructured(path));
|
||||
var eventName = event ||
|
||||
|
Loading…
Reference in New Issue
Block a user