Add example for flattened-nodes-observer

This commit is contained in:
Tim van der Lippe
2017-12-03 17:26:57 +01:00
parent 1fbb5041d9
commit 08ad6e373a
+18
View File
@@ -44,6 +44,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `MutationObserver` and the `<slot>` element's `slotchange` event which
* are asynchronous.
*
* An example:
* ```js
* class TestSelfObserve extends Polymer.Element {
* static get is() { return 'test-self-observe';}
* connectedCallback() {
* super.connectedCallback();
* this._observer = new Polymer.FlattenedNodesObserver(this, (info) => {
* this.info = info;
* });
* }
* disconnectedCallback() {
* super.disconnectedCallback();
* this._observer.disconnect();
* }
* }
* customElements.define(TestSelfObserve.is, TestSelfObserve);
* ```
*
* @memberof Polymer
* @summary Class that listens for changes (additions or removals) to
* "flattened nodes" on a given `node`.