cloudinary-community / svelte-cloudinary

⚡️ High-performance image delivery and uploading at scale in Svelte powered by Cloudinary.
https://svelte.cloudinary.dev/
MIT License
28 stars 14 forks source link

[Feature] Expose `on:load` event on `CldImage` #88

Closed r3Fuze closed 6 months ago

r3Fuze commented 7 months ago

Feature Request

Is your feature request related to a problem? Please describe.

It's not possible to use the on:load event when using the CldImage component.

Describe the solution you'd like

Expose the on:load event so it can be used.

Example:

<CldImage
    src={publicId}
    alt="My image"
    width={256}
    height={256}
    on:load={() => console.log("Image loaded")}
/>

Describe alternatives you've considered

For now I've just reverted to using the underlying @unpic/svelte Image component since it exposes the on:load event.

Additional context

It might be as simple as adding on:load to the CldImage component in src/lib/components/CldImage.svelte like it is done in the @unpic/svelte Image component: https://github.com/ascorbic/unpic-img/blob/main/packages/svelte/src/lib/image.svelte#L42

github-actions[bot] commented 6 months ago

:tada: This issue has been resolved in version 1.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: