oolymer / oo-worker

Polymer mixin to process batches of tasks sorted by priority.
MIT License
0 stars 0 forks source link

(doc) Problem: Background of conditional templating is not documented. #5

Open hastebrot opened 6 years ago

hastebrot commented 6 years ago

Proposed solution: First document the cornerstones:

polymer/lib/mixins/element-mixin.html will stamp the template when super.ready() is called in the custom element. It calls _stampTemplate() from Polymer.TemplateStamp.

ready() {
  if (this._template) {
    this.root = this._stampTemplate(this._template);
    this.$ = this.root.$;
  }
  super.ready();
}

polymer/lib/elements/dom-repeat.html.

<p>Employee list:</p>
<template is="dom-repeat" items="{{employees}}" as="item">
  <employee-item first="{{item.first}}" last="{{item.last}}"></employee-item>
</template>
hastebrot commented 6 years ago

For Polymer 2.x, you do not need to provide your own Promise polyfill if you are using the web components polyfills. Because the web components v1 APIs depend on Promise, a promise polyfill is loaded when needed by the v1 polyfills (web-components-lite.js or webcomponents-loader.js).

https://github.com/PolymerElements/iron-ajax/blob/master/README.md