diff --git a/externs/closure-types.js b/externs/closure-types.js index 7db4746320..0cabb51658 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -78,6 +78,15 @@ Polymer_PropertiesChanged.prototype._enableProperties = function(){}; Polymer_PropertiesChanged.prototype._flushProperties = function(){}; /** * @param {!Object} currentProps Bag of all current accessor values +* @param {!Object} changedProps Bag of properties changed since the last + call to `_propertiesChanged` +* @param {!Object} oldProps Bag of previous values for each property + in `changedProps` +* @return {boolean} +*/ +Polymer_PropertiesChanged.prototype._shouldPropertiesChange = function(currentProps, changedProps, oldProps){}; +/** +* @param {!Object} currentProps Bag of all current accessor values * @param {!Object} changedProps Bag of properties changed since the last call to `_propertiesChanged` * @param {!Object} oldProps Bag of previous values for each property diff --git a/lib/mixins/properties-changed.html b/lib/mixins/properties-changed.html index ac5481b131..203874d523 100644 --- a/lib/mixins/properties-changed.html +++ b/lib/mixins/properties-changed.html @@ -353,7 +353,7 @@ * in `changedProps` * @return {boolean} true if changedProps is truthy */ - _shouldPropertiesChange(props, changedProps, old) { + _shouldPropertiesChange(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars return changedProps; } diff --git a/test/unit/properties-changed.html b/test/unit/properties-changed.html index eebb662706..9ee8417f35 100644 --- a/test/unit/properties-changed.html +++ b/test/unit/properties-changed.html @@ -160,8 +160,7 @@ done(); }); }); - }) - + }); }); diff --git a/types/lib/mixins/properties-changed.d.ts b/types/lib/mixins/properties-changed.d.ts index e7ecd9c5e1..02555dcb96 100644 --- a/types/lib/mixins/properties-changed.d.ts +++ b/types/lib/mixins/properties-changed.d.ts @@ -182,6 +182,21 @@ declare namespace Polymer { */ _flushProperties(): void; + /** + * Called in `_flushProperties` to determine if `_propertiesChanged` + * should be called. The default implementation returns true if + * properties are pending. Override to customize when + * `_propertiesChanged` is called. + * + * @param currentProps Bag of all current accessor values + * @param changedProps Bag of properties changed since the last + * call to `_propertiesChanged` + * @param oldProps Bag of previous values for each property + * in `changedProps` + * @returns true if changedProps is truthy + */ + _shouldPropertiesChange(currentProps: object, changedProps: object, oldProps: object): boolean; + /** * Callback called when any properties with accessors created via * `_createPropertyAccessor` have been set.