Skip to content

Commit

Permalink
Clarify API docs for PropertyAccessors mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Evans authored Nov 1, 2017
1 parent 2d95217 commit ae58e88
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/mixins/property-accessors.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,18 @@
* or more property accessors (getter/setter pair) that enqueue an async
* (batched) `_propertiesChanged` callback.
*
* For basic usage of this mixin, simply declare attributes to observe via
* the standard `static get observedAttributes()`, implement `_propertiesChanged`
* on the class, and then call `MyClass.createPropertiesForAttributes()` once
* on the class to generate property accessors for each observed attribute
* prior to instancing. Last, call `this._enableProperties()` in the element's
* `connectedCallback` to enable the accessors.
* For basic usage of this mixin:
*
* - Declare attributes to observe via the standard `static get observedAttributes()`. Use
* `dash-case` attribute names to represent `camelCase` property names.
* - Implement the `_propertiesChanged` callback on the class.
* - Call `MyClass.createPropertiesForAttributes()` **once** on the class to generate
* property accessors for each observed attribute. This must be called before the first
* instance is created, for example, by calling it before calling `customElements.define`.
* It can also be called lazily from the element's `constructor`, as long as it's guarded so
* that the call is only made once, when the first instance is created.
* - Call `this._enableProperties()` in the element's `connectedCallback` to enable
* the accessors.
*
* Any `observedAttributes` will automatically be
* deserialized via `attributeChangedCallback` and set to the associated
Expand Down

0 comments on commit ae58e88

Please sign in to comment.