bnavetta / aurelia-polymer

Aurelia plugin to support Polymer
MIT License
18 stars 5 forks source link

Polymer lazyRegister=true doesn't seem to be working #29

Open AmitM30 opened 7 years ago

AmitM30 commented 7 years ago

Hi,

We have added the following to the index file: window.Polymer = { dom: 'shady', lazyRegister: true };

but if we turn on the debug for aurelia, it shows that its registering all the element before page is rendered. Is this not supported yet or am I missing something here ?

We are building custom elements using polymer and not all of these are required at homepage. We have also deferred those elements from loading by inject them in respective views.

image

AmitM30 commented 7 years ago

Also, do we need aurelia-polymer with webpack ? It seems to be working without for us :-/

bnavetta commented 7 years ago

I'm not sure what the lazyRegister flag does, but aurelia-polymer just hooks into Polymer's telemetry registration hook. It should just get called whenever elements register themselves. Not sure about webpack, since I haven't used the two together.

AmitM30 commented 7 years ago

From Polymer docs: Support lazy registration of elements. When enabled, this defers most of the work performed at registration time until the first instance of an element is created. If your page includes definitions for many custom elements that are not included in the initial page load, this can improve start-up time by deferring actions like template parsing, style shimming, and data system set up until the elements are used.

Doc link

And, it's not webpack (my bad), I am using vulcanize to load all the elements on index page, else it throws error for duplicate registration.

I have at least 25 widgets built for the entire site and they are segregated by views. I was wishing the registration happened similarly, and so the excitement. :)