Skip to content

Commit

Permalink
chore: easy way to disable sw
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext committed Dec 24, 2023
1 parent 2800611 commit 31f80b4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/utils/service-worker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { createSignal } from 'solid-js';
import { registerSW } from 'virtual:pwa-register';

const REGISTER_SW = true;

const [isUpdateReady, setIsUpdateReady] = createSignal(false);

const updateSW = registerSW({
onNeedRefresh() {
setIsUpdateReady(true);
},
});
const updateSW = REGISTER_SW
? registerSW({
onNeedRefresh() {
setIsUpdateReady(true);
},
})
: () => {};

export { isUpdateReady, updateSW };

0 comments on commit 31f80b4

Please sign in to comment.