johannschopplich / unlazy

🪧 Universal lazy loading library for placeholder images leveraging native browser APIs

Home Page:https://unlazy.byjohann.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditionally disable error logging

johannschopplich opened this issue · comments

Discussed in #34

Originally posted by chrisspiegl October 25, 2023
I am trying to just display a thumbhash in some instances.

But if I do this with UnlazyImage I always get the error on the console:

[unlazy] Missing `data-src` or `data-srcset` attribute

I agree that this makes sense, but is there a way to make it known that I really don't want any src to load? Or maybe a way to prevent the src from loading in any kind of automatic way and only do so when there is a parameter set to true?

I have achieved something like this with a workaround to manually create the src from the thumbhash with the provided functions. But thought this could be cleaner by providing something of a parameter?

Warm regards,
Chris