Trigger a workflow on image load complete

I am retreving an image url from collections.
And then I load that image url on to a container (as background)

Is ther a way to trigger a workflow AFTER the image is fully loaded on browser ?

I want to make sure image is fully loaded before site visitors can do anything else.

Hey @dingan
I’ve tested the following code, and it looks like it’s working.
I put the workflow onMounted event of my image. It basically adds an event listener to the load event of the image.

const img = context.thisInstance.querySelector("img");

img.addEventListener('load', function() {
    console.log('Image loaded');
});

Let me know how that goes!

Thanks Jean

That worked

1 Like