Skip to content

Commit 5c5b18e

Browse files
author
Steven Orvell
committed
Expose an lazierRegister flag to defer additional work until first create time. This change requires that a behavior not implement a custom constructor or set the element's is property.
1 parent adef722 commit 5c5b18e

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎src/lib/base.html‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030

3131
// `this` context is a prototype, not an instance
3232
registerCallback: function() {
33-
// TODO(sjmiles): perhaps this method should be called from polymer-bootstrap?
34-
this._desugarBehaviors(); // abstract
35-
this._doBehavior('beforeRegister'); // abstract
33+
if (!settings.lazierRegister) {
34+
this._desugarBehaviors(); // abstract
35+
this._doBehavior('beforeRegister'); // abstract
36+
}
3637
this._registerFeatures(); // abstract
3738
if (!settings.lazyRegister) {
3839
this.ensureRegisterFinished();
@@ -62,6 +63,13 @@
6263

6364
_ensureRegisterFinished: function(proto) {
6465
if (proto.__hasRegisterFinished !== proto.is) {
66+
// TODO(sorvell): moving all behavior work here means that
67+
// custom constructor and is cannot be done in a behavior.
68+
// This probably means we need another flag for this
69+
if (settings.lazierRegister) {
70+
proto._desugarBehaviors(); // abstract
71+
proto._doBehavior('beforeRegister'); // abstract
72+
}
6573
proto.__hasRegisterFinished = proto.is;
6674
if (proto._finishRegisterFeatures) {
6775
proto._finishRegisterFeatures();

0 commit comments

Comments
 (0)