Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for lazy-loading pages #28

Open
vinerz opened this issue Jan 20, 2016 · 6 comments
Open

Add support for lazy-loading pages #28

vinerz opened this issue Jan 20, 2016 · 6 comments

Comments

@vinerz
Copy link

vinerz commented Jan 20, 2016

It would be very nice to use a markup like this:

<iron-pages lazy>
  <page></page>
  <page></page>
  <page></page>
</iron-pages>

That under the hood wraps the <page>s into <template dom-if="{{_equals(selected, ....)}}">

This way we could be able to not load large chunks of DOM when not necessary instead of just using display: none, besides the great advantage of not loading nearly not used sections of the app into memory.

@TimvdLippe
Copy link

Our usecase could also benefit from this. We had an auto-triggering iron-ajax on our page which was still firing, even if that page was not loaded. If the pages are instead wrapped in the dom-if, we can listen for the attached event and correctly fire the request when needed.

@TimvdLippe
Copy link

FWIW I have built iron-lazy-pages: https://github.com/TimvdLippe/iron-lazy-pages

@vinerz
Copy link
Author

vinerz commented Jan 3, 2017

Will check it out! Thanks 😃

@tpluscode
Copy link

Another way is to exclude load page elements lazily with this.importHref or lazy-imports

@stramel
Copy link

stramel commented May 4, 2017

👍 using lazy-imports

@TimvdLippe
Copy link

I have just pushed support for dom-if in iron-lazy-pages. The implementation is rather naive: just mimic the if property to the selected/deselected to trigger the dom-if restamping. Check it out at TimvdLippe/iron-lazy-pages#56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants