kodama-ui
Version:
Kodama UI is a Vue 3 component library that provides a set of components & funcionality to build your application.
43 lines (42 loc) • 1.36 kB
JavaScript
function m(w = {}) {
const {
immediate: g = !1,
onNeedRefresh: r,
onOfflineReady: t,
onRegistered: n,
onRegisteredSW: c,
onRegisterError: o
} = w;
let e, d, a;
const u = async (p = !0) => {
await d, await (a == null ? void 0 : a());
};
async function f() {
if ("serviceWorker" in navigator) {
const { Workbox: p } = await import("./workbox-window.prod.es5-5e28cea8.mjs");
e = new p("/sw.js", { scope: "/", type: "classic" }), a = async () => {
await (e == null ? void 0 : e.messageSkipWaiting());
};
{
let i = !1;
const l = () => {
i = !0, e == null || e.addEventListener("controlling", (s) => {
s.isUpdate && window.location.reload();
}), r == null || r();
};
e.addEventListener("installed", (s) => {
typeof s.isUpdate > "u" ? typeof s.isExternal < "u" ? s.isExternal ? l() : !i && (t == null || t()) : s.isExternal ? window.location.reload() : !i && (t == null || t()) : s.isUpdate || t == null || t();
}), e.addEventListener("waiting", l), e.addEventListener("externalwaiting", l);
}
e.register({ immediate: g }).then((i) => {
c ? c("/sw.js", i) : n == null || n(i);
}).catch((i) => {
o == null || o(i);
});
}
}
return d = f(), u;
}
export {
m as r
};