You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling a Laminar application to Wasm, renderOnDomContentLoaded silently "does nothing". This is because Wasm apps are loaded through a top-level await, which typically means that when the main method executes, the DOM has already loaded.
If a "DOMContentLoaded" listener is registered after the DOM has already loaded, the event never gets fired.
Hi,
When compiling a Laminar application to Wasm,
renderOnDomContentLoaded
silently "does nothing". This is because Wasm apps are loaded through a top-levelawait
, which typically means that when themain
method executes, the DOM has already loaded.If a
"DOMContentLoaded"
listener is registered after the DOM has already loaded, the event never gets fired.MDN recommends to check as follows:
Indeed, I was able to work around the issue by doing the following in my
main
method in Scala.js:When compiling to Wasm,
"hello 2"
shows up.Should we integrate that test directly into Laminar's
renderOnDomContentLoaded
so that others don't get confused the way I was? Something like:The text was updated successfully, but these errors were encountered: