What is the status of Service Workers for Kotlin/J...
# javascript
What is the status of Service Workers for Kotlin/JS? I currently have the following solution:
Copy code
external val self: ServiceWorkerGlobalScope

fun main() {
    try {
            .then { console.log("Service worker registered!") }
            .catch { console.error("Service Worker registration failed: $it") }
        console.log("This is a the main script!")
    } catch(e: Throwable) {
        console.log("This is a Service Worker!")
        self.addEventListener("install", {
            console.log("Service Worker installed!")
        self.addEventListener("activate", {
            console.log("Service Worker activated: $it")
        self.addEventListener("sync", {
            console.log("Service Worker sync: $it")
It works, but it is kind of awkward. Anyone else got an idea of how to do it?