Skip to content

Commit

Permalink
doc: invoke super methods in example
Browse files Browse the repository at this point in the history
  • Loading branch information
sastan committed Dec 26, 2020
1 parent 0912e1b commit fc412a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/observe.md
Expand Up @@ -82,7 +82,9 @@ observer.disconnect(node)

## Example

> This example show how a custom observer instance can be used to shim a web component.
This example shows how a custom observer instance can be used to shim a web component.

> This example is using [Constructable Stylesheet Objects](https://wicg.github.io/construct-stylesheets/) and `DocumentOrShadowRoot.adoptedStyleSheets` which have [limited browser support](https://caniuse.com/mdn-api_documentorshadowroot_adoptedstylesheets) at the moment (December 2020).
```js
import { LitElement, html } from 'lit-element'
Expand All @@ -101,11 +103,13 @@ class TwindElement extends LitElement {

// 4. Start observing class attributes changes
connectedCallback() {
super.connectedCallback()
this._observer = createObserver(instance).observe(this.renderRoot)
}

// 5. Stop observing class attributes changes
disconnectedCallback() {
super.disconnectedCallback()
this._observer.disconnect()
}

Expand Down

0 comments on commit fc412a7

Please sign in to comment.