Winson Chiu
01/17/2025, 11:59 PMWinson Chiu
01/18/2025, 2:37 AMcommonMain into nonJsCommonMain for the actual app, then create a js("worker") target, and attach wasmJsProcessResources dependsOn workerBrowserDistribution along with wasmJsMain.dependencies.resources.srcDirs(layout.buildDirectory.dir("dist/worker/productionExecutable") . Then in an init/app .js file, you can register the service worker pointing to the JS file navigator.serviceWorker.register("worker.js").
For actually handling the service events, creating a fun main() inside the Worker.kt file seems to work and gets executed when the worker is created.