This commit is contained in:
Vanessa 2023-04-19 18:55:50 +08:00
parent d76180796c
commit 26e77a3529
5 changed files with 9 additions and 10 deletions

View file

@ -1,8 +1,8 @@
// https://github.com/siyuan-note/siyuan/pull/8012
export const registerServiceWorker = (scriptURL: string) => {
if (!'serviceWorker' in navigator || typeof (navigator.serviceWorker) === 'undefined' ||
!'caches' in window || !'fetch' in window) {
return
if (!"serviceWorker" in navigator || typeof (navigator.serviceWorker) === "undefined" ||
!"caches" in window || !"fetch" in window) {
return;
}
// REF https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration
window.navigator.serviceWorker