Skip to content

Commit

Permalink
Update JSDocs to use <dom-repeat> tags
Browse files Browse the repository at this point in the history
Update jsdocs to recommended use of wrapper custom elements from https://www.polymer-project.org/2.0/docs/about_20#type-extension
  • Loading branch information
floribon committed Feb 1, 2018
1 parent 82cd3da commit 636abae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
50 changes: 30 additions & 20 deletions lib/elements/array-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -373,40 +373,50 @@
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" id="employeeList" items="{{employees}}">
* <dom-repeat id="employeeList" items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
* </dom-repeat>
*
* <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector>
*
* <div> Selected employees: </div>
* <template is="dom-repeat" items="{{selected}}">
* <dom-repeat items="{{selected}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
* </dom-module>
* ```
*
* ```js
* Polymer({
* is: 'employee-list',
* ready() {
* this.employees = [
* {first: 'Bob', last: 'Smith'},
* {first: 'Sally', last: 'Johnson'},
* ...
* ];
* },
* toggleSelection(e) {
* let item = this.$.employeeList.itemForElement(e.target);
* this.$.selector.select(item);
* }
* });
*class EmployeeList extends Polymer.Element {
* static get is() { return 'employee-list'; }
* static get properties() {
* return {
* employees: {
* value() {
* return [
* {first: 'Bob', last: 'Smith'},
* {first: 'Sally', last: 'Johnson'},
* ...
* ];
* }
* }
* };
* }
* toggleSelection(e) {
* let item = this.$.employeeList.itemForElement(e.target);
* this.$.selector.select(item);
* }
*}
* ```
*
* @polymer
Expand Down
9 changes: 5 additions & 4 deletions lib/elements/dom-repeat.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" items="{{employees}}">
* <dom-repeat items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
Expand Down Expand Up @@ -116,8 +118,7 @@
* Then the `observe` property should be configured as follows:
*
* ```html
* <template is="dom-repeat" items="{{employees}}"
* filter="isEngineer" observe="type manager.type">
* <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type">
* ```
*
* @customElement
Expand Down
9 changes: 5 additions & 4 deletions types/lib/elements/dom-repeat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ declare namespace Polymer {
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" items="{{employees}}">
* <dom-repeat items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
Expand Down Expand Up @@ -105,8 +107,7 @@ declare namespace Polymer {
* Then the `observe` property should be configured as follows:
*
* ```html
* <template is="dom-repeat" items="{{employees}}"
* filter="isEngineer" observe="type manager.type">
* <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type">
* ```
*/
class DomRepeat extends
Expand Down

0 comments on commit 636abae

Please sign in to comment.