forked from abner/for-legacy-web
Import assets and add PWA.
This commit is contained in:
14
src/main.tsx
14
src/main.tsx
@@ -2,5 +2,19 @@ import { render } from "preact";
|
||||
import "./styles/index.scss";
|
||||
import { App } from "./app";
|
||||
|
||||
import { registerSW } from 'virtual:pwa-register'
|
||||
|
||||
const updateSW = registerSW({
|
||||
onNeedRefresh() {
|
||||
// ! FIXME: temp
|
||||
updateSW(true);
|
||||
// show a prompt to user
|
||||
},
|
||||
onOfflineReady() {
|
||||
console.info('Ready to work offline.');
|
||||
// show a ready to work offline to user
|
||||
},
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
render(<App />, document.getElementById("app")!);
|
||||
|
||||
Reference in New Issue
Block a user