Revela-Frontend/public/register-sw.js
David Reed d75d7fde3a
correct SW field
config.sw should point to uv.sw.js, not the stock sw.js
we now use a fixed path in register-sw.js
2022-12-03 15:51:18 -05:00

19 lines
452 B
JavaScript

"use strict";
/**
* Distributed with Ultraviolet and compatible with most configurations.
*/
const stockSW = "/uv/sw.js";
/**
* Global util
* Used in 404.html and index.html
*/
async function registerSW() {
if (!navigator.serviceWorker)
throw new Error("Your browser doesn't support service workers.");
// Ultraviolet has a stock `sw.js` script.
await navigator.serviceWorker.register(stockSW, {
scope: __uv$config.prefix,
});
}