Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
feat(deps): add @sws2apps/react-sw-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao authored May 18, 2022
1 parent df9055f commit bc4722d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
22 changes: 20 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@mui/icons-material": "^5.8.0",
"@mui/lab": "^5.0.0-alpha.82",
"@mui/material": "^5.8.0",
"@sws2apps/react-sw-helper": "^1.0.0-alpha.3",
"dateformat": "^5.0.3",
"dexie": "^3.2.2",
"dexie-export-import": "^1.0.3",
Expand Down
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { createRoot } from 'react-dom/client';
import { RecoilRoot } from 'recoil';
import RecoilOutside, { promiseSetRecoil } from 'recoil-outside';
import WithServiceWorker from './components/root/WithServiceWorker';
import ServiceWorkerWrapper from '@sws2apps/react-sw-helper';
import './i18n';
import App from './App';
import '@fontsource/roboto/300.css';
Expand All @@ -18,16 +18,15 @@ const root = createRoot(container);
root.render(
<RecoilRoot>
<RecoilOutside />
<WithServiceWorker
registerOnMount={process.env.NODE_ENV === 'production'}
<ServiceWorkerWrapper
onError={(err) => console.log(`An error occured: ${err}`)}
onInstalled={() => onSWInstalled()}
onUpdated={() => onSWUpdated()}
onStaled={() => onSWUpdated()}
publicServiceWorkerDest='/service-worker.js'
>
{({ update }) => <App updatePwa={update} />}
</WithServiceWorker>
</ServiceWorkerWrapper>
</RecoilRoot>
);

Expand Down

0 comments on commit bc4722d

Please sign in to comment.