More API docs.

This commit is contained in:
Kevin Schaaf
2017-02-28 17:07:32 -08:00
parent c3d7f10352
commit e194d40afd
2 changed files with 71 additions and 9 deletions

View File

@@ -59,7 +59,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* TODOC
* Legacy callback called during the `constructor`, for overriding
* by the user.
*/
created() {}
@@ -70,7 +71,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* TODOC
* Legacy callback called during `connectedCallback`, for overriding
* by the user.
*/
attached() {}
@@ -81,7 +83,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* TODOC
* Legacy callback called during `disconnectedCallback`, for overriding
* by the user.
*/
detached() {}
@@ -93,7 +96,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* TODOC
* Legacy callback called during `attributeChangedChallback`, for overriding
* by the user.
*/
attributeChanged() {}

View File

@@ -514,10 +514,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Overrides the default `Polymer.PropertyAccessors` to ensure class
* metaprogramming related to property accessors and effects is completed.
* metaprogramming related to property accessors and effects has
* completed (calls `finalize`).
*
* It also initializes any property defaults based on the `properties`
* metadata's `value` property.
* It also initializes any property defaults provided via `value` in
* `properties` metadata.
*
* @override
*/
@@ -550,6 +551,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/**
* Provides a default implementation of the standard Custom Elements
* `connectedCallback`.
*
* The default implementation enables the property effects system and
* flushes any pending properties, and updates shimmed CSS properties
* when using the ShadyCSS scoping/custom properties polyfill.
*
* @override
*/
connectedCallback() {
if (window.ShadyCSS) {
window.ShadyCSS.styleElement(this);
@@ -557,8 +568,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this._flushProperties();
}
/**
* Provides a default implementation of the standard Custom Elements
* `disconnectedCallback`.
*
* @override
*/
disconnectedCallback() {}
/**
* Overrides the `Polymer.PropertyEffects` ready callback to attach
* the stamped template content (`this.root`) to the dom.
*
* @override
*/
ready() {
super.ready();
if (this._template) {
@@ -567,7 +590,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* Attach an element's stamped dom to itself. By default,
* Attaches an element's stamped dom to itself. By default,
* this method creates a `shadowRoot` and adds the dom to it.
* However, this method may be overridden to allow an element
* to put its dom in another location.
@@ -595,6 +618,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/**
* Provides a default implementation of the standard Custom Elements
* `attributeChangedCallback`.
*
* By default, attributes declared in `properties` metadata are
* deserialized using their `type` information to properties of the
* same name. "Dash-cased" attributes are deserialzed to "camelCase"
* properties.
*
* @override
*/
attributeChangedCallback(name, old, value) {
if (old !== value) {
let property = caseMap.dashToCamelCase(name);
@@ -651,17 +685,41 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return PolymerElement;
});
// telemetry
/**
* Provides basic tracking of element definitions (registrations) and
* instance counts.
*
* @namespace
*/
Polymer.telemetry = {
/**
* Total number of Polymer element instances created.
* @type {number}
*/
instanceCount: 0,
/**
* Array of Polymer element classes that have been finalized.
* @type {Array<Polymer.Element>}
*/
registrations: [],
/**
* @private
*/
_regLog: function(prototype) {
console.log('[' + prototype.is + ']: registered')
},
/**
* Registers a class prototype for telemetry purposes.
* @protected
*/
register: function(prototype) {
this.registrations.push(prototype);
Polymer.log && this._regLog(prototype);
},
/**
* Logs all elements registered with an `is` to the console.
* @public
*/
dumpRegistrations: function() {
this.registrations.forEach(this._regLog);
}