My OCD has been satisfied. 🙂 Thanks again Jens.
public static void loadImage(String imgBase64, Consumer<HTMLImageElement>
loaded) {
HTMLImageElement img = (HTMLImageElement)DomGlobal.document.createElement(
ImageElement.TAG);
img.addEventListener(BrowserEvents.LOAD, e -> loaded.accept(img));
img.addEventListener(BrowserEvents.ERROR, e ->
DomGlobal.console.error("Failed
to load image."));
img.src = imgBase64;
}
On Thursday, 31 July 2025 at 7:45:19 pm UTC+10 Jens wrote:
> btw: With addEventListener, we have to use hard coded strings for the
> event name. Eg:
>
> img.addEventListener("load", e -> doStuff());
>
> Or are there event name constants we can use somewhere?
>
>
> GWT has com.google.gwt.dom.client.BrowserEvents but it is not a complete
> list.
>
> -- J.
>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/google-web-toolkit/261f0865-534c-49e6-afdb-5e4f60e377acn%40googlegroups.com.