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

Lazy load rAf implementation #251

Open
mehulkar opened this issue Sep 9, 2020 · 3 comments
Open

Lazy load rAf implementation #251

mehulkar opened this issue Sep 9, 2020 · 3 comments

Comments

@mehulkar
Copy link
Contributor

mehulkar commented Sep 9, 2020

It would be nice if the rAF implementation was not loaded if the browser supports IntersectionObserver.

@snewcomer
Copy link
Collaborator

Hey! Could you detail what you are thinking in this regards? I looked around and tried digging up some ideas - we don't initialize the raf-pool if the browser supports IObserver (thus no requestAnimationFrame). I'm sure I missed something though.

@mehulkar
Copy link
Contributor Author

mehulkar commented Oct 5, 2020

I was thinking this whole file: https://github.com/DockYard/ember-in-viewport/blob/master/addon/-private/raf-admin.js and the raf-pool dependency could be changed to be dynamically imported, and only loaded if IntersectionObserver is not defined. Not quite sure how/when that would happen.

@snewcomer
Copy link
Collaborator

That seems like an optimal idea! Although I think we would need to make the async chain all the way up to watchElement...Certainly worth exploring but would be quite a big change.

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

No branches or pull requests

2 participants