I have a question, which I think I should have kno...
# webassembly
o
I have a question, which I think I should have known the answer to at this point. When I plan to develop using Kwasm, I only select the web option in the wizard, so I never really had a use for the commonMain src set. Back when Kwasm was in alpha, the entry point was in wasmaJsMain. Now it is in webMain. But I am now having a challenge accessing code that I write in wasmJsMain in web main. For instance, I wrote a custom navigation class that essentially listens for back and forward browser events and intercepts them. Long story short, I am able to show different "pages" based on a manual page state and navigate to them, etc., but this only works in wasmJsMain since it makes use of certain browser APIs, among other things, that are not accessible in webMain for some reason. My question is how can I access these functions, classes, etc., in wasmJsMain from webMain, or can I switch the entry point back to wasmJsMain?
OK, I see moving the main function to wasmJsMain solved my issue.
o
the hierarchy is opposite: The wasmJsMain source set depends on the webMain source set. So you can use all the public and internal functions declared in webMain from your wasmJsMain.
c
Not sure if it's updated yet, but think https://github.com/Kotlin/kotlinx-browser has been updated to use webMain so you can target both targets from web if you need, vs having to write in both wasmJs and js source sets
o
I will check it out, thanks.