You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The static get template() { ... } field on Polymer 3's class syntax is lazy; i.e. it won't invoke the function (which normally does the template parsing) until the element is instanced, which is a performance optimization when element definitions are loaded but not immediately instanced.
However the legacy Polymer({ _template: ... }) field basically requires providing a concrete template. Unfortunately, implementing a get _template() { ... } getter is not sufficient, since for legacy reasons Polymer sets the finalized template back to prototype._template, hence it also needs a setter that overrides the original value. This becomes rather cumbersome to author.
This issue is to make a minor change to the legacy Polymer template processing to allow setting a function to _template on the Polymer info object. The type of the value will be checked, and if it is a function it will be run once and the return value will be used.
Versions
Polymer: v3/master
The text was updated successfully, but these errors were encountered:
Description
The
static get template() { ... }
field on Polymer 3's class syntax is lazy; i.e. it won't invoke the function (which normally does the template parsing) until the element is instanced, which is a performance optimization when element definitions are loaded but not immediately instanced.However the legacy
Polymer({ _template: ... })
field basically requires providing a concrete template. Unfortunately, implementing aget _template() { ... }
getter is not sufficient, since for legacy reasons Polymer sets the finalized template back toprototype._template
, hence it also needs a setter that overrides the original value. This becomes rather cumbersome to author.This issue is to make a minor change to the legacy
Polymer
template processing to allow setting a function to_template
on thePolymer
info object. The type of the value will be checked, and if it is a function it will be run once and the return value will be used.Versions
The text was updated successfully, but these errors were encountered: