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

[IDEA] On load actions for image widget #8923

Open
saqimtiaz opened this issue Jan 31, 2025 · 2 comments
Open

[IDEA] On load actions for image widget #8923

saqimtiaz opened this issue Jan 31, 2025 · 2 comments

Comments

@saqimtiaz
Copy link
Member

It is proposed to add support to the image widget for actions that are invoked on image load. We already have a load event listener for the image widget that adds the class tc-image-loaded that can be used to invoke these actions.

I have been using this feature in a subclass of the image widget and been getting a lot of mileage out of it. For example: pre-loading an image and then triggering the start of a slideshow after the image has loaded.

An alternative to consider is a more generic affordance for attaching event listeners to elements created by widgets. The EventCatcher only works for events that bubble. I do not have a feasible proposal for such a widget, a wrapper widget that attaches an event listener to a child is error prone due to the refresh cycle.

@pmario
Copy link
Member

pmario commented Jan 31, 2025

I think the idea is valid, but what I would like to avoid is the misuse of "triggering" actions with 1x1 invisible images.

If users use it in the right way, it will be powerful. If used wrong we do have the potential for endless loops. --- I'm not sure.

@Jermolene
Copy link
Member

Thanks @saqimtiaz, I agree that actions on image load would be useful.

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