chromestatus.com - how did it lazyload `use metrics` elements?

19 views
Skip to first unread message

Darin Hensley

unread,
Feb 9, 2017, 9:18:41 PM2/9/17
to Polymer
How did chromestatus.com lazyload it's element(s) for `use metrics`? When I click on `use metrics`, I see in the network tab that only then it is loaded and stamped...not when the app loads.

Originally, I thought `lazyRegister: max` took care of this automatically. But in my set up:

        <iron-pages attr-for-selected="data-route" selected="{{route}}">
          <user-login data-route="user-login"></user-login>
          <single-listing data-route="single-listing"></single-listing>
         </iron-pages>

Element `single-listing` element loads when the app initially loads, even when I have window.Polymer = { lazyRegister: 'max' }

Is possible to see the code of chromestatus to see how they lazyloaded their element? And is the behavior even possible with iron-pages?

Eric Bidelman

unread,
Feb 9, 2017, 9:33:14 PM2/9/17
to Darin Hensley, Polymer
chromestatus uses Polymer.Base.importHref() to lazy load a vulcanized bundle when that button is clicked.
You'll only see one network request made b/c after the first click, importHref() checks if the import is already
loaded on the page.



Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/3fec0a07-862b-4778-a214-31c22368a9af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages