Skip to content

Commit

Permalink
Add example for flattened-nodes-observer
Browse files Browse the repository at this point in the history
  • Loading branch information
TimvdLippe committed Dec 3, 2017
1 parent 1fbb504 commit 08ad6e3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/utils/flattened-nodes-observer.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@
* `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`.
Expand Down

0 comments on commit 08ad6e3

Please sign in to comment.