Enable installing app as pwa
This commit is contained in:
11
app/javascript/custom/companion.js
Normal file
11
app/javascript/custom/companion.js
Normal file
@@ -0,0 +1,11 @@
|
||||
if (navigator.serviceWorker) {
|
||||
navigator.serviceWorker
|
||||
.register("/service-worker.js", { scope: "/" })
|
||||
.then(() => navigator.serviceWorker.ready)
|
||||
.then((registration) => {
|
||||
if ("SyncManager" in window) {
|
||||
registration.sync.register("sync-forms");
|
||||
}
|
||||
})
|
||||
.then(() => console.log("[Companion]", "Service worker registered!"));
|
||||
}
|
||||
Reference in New Issue
Block a user