-
Notifications
You must be signed in to change notification settings - Fork 529
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
Restart scala.js runtime environment #1959
Comments
This is very interesting! How would you expect this to work exactly? Just an |
Yes! a method on |
Do you just want it exposed to JavaScript, or is this something you would call from Scala? |
I wouldn't expect to call it from java on my use case of HMR. And it would need to be a kind of |
I think this is sufficiently addressed as of #2114. If you disagree, leave a comment and I'll reopen! |
So I wasn't around when this originally came up, but I think the right solution here is that browser applications that have bespoke needs just shouldn't use
Calico offers an Tyrian offers a Indeed, even the application that prompted this issue is simply exporting |
We build all our scala.js apps with cats-effect 3 starting with
IOApp
which is exported to the js runtime. e.g.https://github.com/gemini-hlsw/explore/blob/fef6caaafdafa144b6a9ae04afad18990467e132/explore/src/main/scala/explore/Explore.scala#L61
This works fine for the regular browser case and node but has some restrictions when doing development on browser.
There we often want to use HMR (Hot module replacement) where the dev environent detects changes to the compiled scala.js output and reloads the js code without a browser reload.
In practice this means we call
IOApp.main
again, however the code below can only be ever called once.https://github.com/typelevel/cats-effect/blob/series/3.x/core/js/src/main/scala/cats/effect/IOApp.scala#L33
Would it be possible to add a method that could be called on replacement to reset the environment such that another call to
IOApp.main
wouldn't fail?The text was updated successfully, but these errors were encountered: