@bbki.ng/site 1.1.26 → 1.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/components/reload_prompt/index.tsx +12 -12
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@ import { toast } from "sonner";
|
|
|
2
2
|
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import { useRegisterSW } from "virtual:pwa-register/react";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
const intervalMS = 60 * 60 * 1000;
|
|
6
7
|
|
|
7
8
|
export const ReloadPrompt = () => {
|
|
8
9
|
const {
|
|
@@ -12,21 +13,20 @@ export const ReloadPrompt = () => {
|
|
|
12
13
|
onRegisterError(error: any) {
|
|
13
14
|
console.log("SW registration error", error);
|
|
14
15
|
},
|
|
16
|
+
onRegisteredSW(
|
|
17
|
+
swScriptUrl: string,
|
|
18
|
+
registration: ServiceWorkerRegistration
|
|
19
|
+
) {
|
|
20
|
+
console.log("SW registered: ", swScriptUrl, registration);
|
|
21
|
+
registration &&
|
|
22
|
+
setInterval(() => {
|
|
23
|
+
registration.update().then(() => {});
|
|
24
|
+
}, intervalMS);
|
|
25
|
+
},
|
|
15
26
|
onOfflineReady() {
|
|
16
27
|
console.log("App is offline-ready");
|
|
17
28
|
},
|
|
18
29
|
});
|
|
19
|
-
|
|
20
|
-
const [time, setTime] = useState(new Date());
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const interval = setInterval(() => {
|
|
24
|
-
setTime(new Date());
|
|
25
|
-
}, 1000);
|
|
26
|
-
|
|
27
|
-
return () => clearInterval(interval);
|
|
28
|
-
}, []);
|
|
29
|
-
|
|
30
30
|
if (!needRefresh) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|