-
Notifications
You must be signed in to change notification settings - Fork 179
add onWasmReady
#445
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
base: master
Are you sure you want to change the base?
add onWasmReady
#445
Conversation
val name = initRoute.substringAfter("patient_").substringBefore("_") | ||
val id = initRoute.substringAfter("patient_").substringAfter("_").toLong() | ||
navController.navigate(Patient(name, id)) | ||
// `onWasmReady` ensures initialization in Kotlin/JS, not required in Kotlin/Wasm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be precise, onWasmReady
is not available in Kotlin/Wasm at all, so this snippet won't compile when copied as is and pasted in kotlin/wasm source set.
I understand that duplicating this snippet is not good. Maybe the comment could specify this distinction between k/js and k/wasm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure which I prefer, because people can and will copy-paste this without reading and be upset when it doesn't work.
@ElviraMustafina I would separate the JS and Wasm code clearly, maybe collapsing both of the big code blocks. But tell me how you see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added separate, switchable tabs for Kotlin/Wasm and Kotlin/JS code.
@@ -63,7 +63,8 @@ Users can use the **Back** and **Forward** buttons in the browser to move betwee | |||
as well as use the address bar to understand where they are and get to a destination directly. | |||
|
|||
To bind the web app to the navigation graph defined in your common code, | |||
call the `window.bindToNavigation()` method in your Kotlin/Wasm or Kotlin/JS code: | |||
you can use the `window.bindToNavigation()` method in your Kotlin/Wasm code. For Kotlin/JS, ensure this code runs within |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expand a tiny bit here: something like "you can use the same method in Kotlin/JS, but make sure to wrap the code..."
``` | ||
<!--{default-state="collapsed" collapsible="true" collapsed-title="val initRoute = window.location.hash.substringAfter( ..."}--> | ||
fun main() { | ||
onWasmReady { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would still be great to comment on what this actually does — here, or at the top, where we mention it for the first time. Or both :)
No description provided.