zerodevx / svelte-img

High-performance responsive/progressive images for SvelteKit
https://zerodevx.github.io/svelte-img/
ISC License
300 stars 11 forks source link

Add fetchpriority to SvelteImg.svelte #44

Closed leoj3n closed 4 months ago

leoj3n commented 4 months ago

Closes #42

zerodevx commented 4 months ago

Hmm not sure if this is needed it's already supported: https://github.com/zerodevx/svelte-img/issues/42#issuecomment-1981140807

Edit: unless the intention is to set a default fetchpriority other than auto?

leoj3n commented 4 months ago

I'll just say as a consumer of the APIs provided to us by the browser gods, I have seen a lot of benefit manually specifying fetchpriority. When compared to decoding which is already implemented, I have never seen decoding make a noticeable difference in scores or objectively. I have opened another issue questioning the wisdom of always setting a value for performance toggles. I would think of this more of a hint to unfamiliar users that it is something that exists which they may wish to leverage. Alternatively the library could offer a default set of optimization settings for "above-the-fold" and "below-the-fold" images. However, I feel this obscures knowledge the user should have about how this all works. I think I would keep it basic and fill the gaps with documentation about what setting you probably want for X type of image.

zerodevx commented 4 months ago

As discussed in #42, gonna close this in favour of documenting in readme, or via a @typedef.

Thanks so much for bringing this up! 🙏