Hey everybody! Went down the compose rabbit hole y...
# kobweb
n
Hey everybody! Went down the compose rabbit hole yesterday and came across Kobweb. I've worked with KMP before for iOS/Android but new to compose. For my new project I want to start with a PWA and pull that in with a shared webview, ideally want to share business logic across mobile/web as well. Anyone kick something like this around yet?
c
If you're going to make Android and iOS apps, why go PWA instead of going native? To share domain code between KJS and the other platforms, you can simply create a multiplatform library module and depend on it from each platform. To share UI code, I'm working on #decouple but it's at least 2 or 3 years from being usable… To share data, you may be interested in https://github.com/cashapp/zipline.
But indeed, you can go full PWA with Kobweb only. I'm not sure how much tooling exists at the moment for this use case, Kobweb is still young so efforts mostly go towards making websites at the moment. It probably does work without major issues though.
d
I just looked up the steps for creating a PWA (which is a usecase I'd definitely like to support someday). Looks like everything is there except service worker support -- although it would be possible to create that without Kobweb. Note that Kobweb does support web workers, so it's possible either service workers can work using it as is or maybe the code requires a small tweak. I'll add an issue to take a look but it's not going to be a priority for a bit.
Here's a document I kept when researching workers in Kotlin/JS . There's some links in there to articles about how to create a worker manually.
I'd also be curious how you respond to Ivan's question!
n
@CLOVIS need to start with web support from the jump for the use case and iteratively introduce mobile where needed as needed. I'm not looking to share the UI at the moment but instead just pull the PWA into a webview initially.
d
One thing to note about workers in Kotlin JS is each worker needs its own (dead code eliminated) version of the runtime. I talk about it here at the end of this section: <https://github.com/varabyte/kobweb?tab=readme-ov-file#when-to-use-kobweb-workers>
👍 1
n
@David Herman I think I'd be okay with creating the worker outside of Kobweb. Just trying to understand what the initial lift is going to be here and if it makes sense. Maybe it's best to just run with Ktor if I'm not looking to share elements across web beyond the PWA.
d
In that case, you can look into creating a worker js file and put it in your resources/public folder. Good luck!
n
The more I chew on this the more I want to try this out Kobweb. I think I'm going to give it a soft touch and see where I get.
👍 1
d
I hope you enjoy the test run! Sometimes I don't get slack notifications but I try to be around every day if people have questions.