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

useLazyLoad: Undocumented behavior #118

Open
weaverryan opened this issue Mar 8, 2021 · 2 comments
Open

useLazyLoad: Undocumented behavior #118

weaverryan opened this issue Mar 8, 2021 · 2 comments

Comments

@weaverryan
Copy link
Contributor

Hi again!

I was going through the source tonight and noticed useLazyLoad. It's not documented or in the playground. Is that simply accidental? Is it functional and usable?

Thanks!

@adrienpoly
Copy link
Contributor

Yes it is functional while very basic compared to alternative such as (https://github.com/verlok/vanilla-lazyload). It is a derivative of useIntersection using the IntersectionObserver API.
I built it at the very start of this library mostly for testing the Observers. I never officially released it as I am not convinced this is still a relevant feature to have when most modern browser (except Safari) have the built-in feature `loading="lazy".

If you want to test it here is a basic html that should work

<img data-controller="lazy-load" data-src="some-image-url">

@evenreven
Copy link

evenreven commented Aug 13, 2021

Since the Safari devs are being so slow with this, I'd argue that this is a relevant feature, and I'd love to use this as a composable behaviour. Also, Firefox devs seem to have no rush implementing loading=lazy for iframes, which is almost more important than for images if your site embeds YouTube videos. (I think it's borderline hilarious that Google (through Lighthouse) punishes devs for using Google products (i.e. YouTube, which is so full of bad scripts and placeholder images Lighthouse docks you several points if you don't lazyload the iframe).)

@marcoroth marcoroth changed the title useLazyLoad: Undocumented behavior useLazyLoad: Undocumented behavior Aug 6, 2022
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

3 participants