varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.51k stars 68 forks source link

Support specifying a script for Web Workers #389

Closed bitspittle closed 8 months ago

bitspittle commented 9 months ago

Relevant links a dev shared with me about this:

I set this feature request to a 1.0 milestone for now, but technically this can slip to post-1.0 if implementation is complex.

However, at least it should be checked before we finalize 1.0, because web workers are a pretty standard and major feature in web dev. If Kobweb made them easy to use, that could be a nice win for the framework.

And maybe it's more trivial than one might think to integrate them in Kobweb? Or maybe we'll need to add a new Kobweb worker Gradle plugin to tag modules as specifically web workers?

And finally, perhaps playing around with them will help me see there are some APIs (like extension methods) I should update in Kobweb. I ran across the WindowOrWorkerGlobalScope interface the other day, and maybe I've created some utility methods right now that work with normal code but not web workers, and it would be trivial to change the code to support it.

bitspittle commented 8 months ago

I am happy to report that this feature made it into 0.15.4.

More info in the README: https://github.com/varabyte/kobweb/tree/v0.15.4#creating-a-kobweb-worker

And I'll update the empty template and add an example template in the next few days showcasing the feature in action.