API
| Function | Import | Purpose |
|---|---|---|
lazyLoad | unlazy | Initialize lazy loading with placeholder generation |
autoSizes | unlazy | Calculate sizes attribute without lazy loading |
triggerLoad | unlazy | Programmatically load an image immediately |
createPlaceholderFromHash | unlazy | Generate PNG data URI from hash (client-side) |
reportImageOutcome | unlazy | Set or clear data-error and call onImageLoad or onImageError for an image that loads its own sources |
resolveImageAttributes | unlazy | Resolve the <img> and <source> attributes, the lazyLoad options, and a loadKey of an UnLazyImage component from its props |
createPngDataUri | unlazy/blurhash | Generate PNG data URI from BlurHash (SSR) |
createPngDataUri | unlazy/thumbhash | Generate PNG data URI from ThumbHash (SSR) |
Constants
| Constant | Import | Purpose |
|---|---|---|
isCrawler | unlazy | Boolean indicating if the current visitor is detected as a bot or crawler |
Types
| Type | Import | Purpose |
|---|---|---|
UnLazyLoadOptions | unlazy | Options for the lazyLoad function |
TriggerLoadOptions | unlazy | Options for the triggerLoad function, which UnLazyLoadOptions extends |
AutoSizesOptions | unlazy | Options for the autoSizes function |
CreatePlaceholderFromHashOptions | unlazy | Options for the createPlaceholderFromHash function |
UnLazySource | unlazy and every adapter package | One <source> of the sources prop |
UnLazyImageProps | unlazy | Props every UnLazyImage component shares |
UnLazyImageAttributes | unlazy | Return type of resolveImageAttributes |