commit | author | age
|
998a46
|
1 |
/* eslint-disable no-console */ |
D |
2 |
|
|
3 |
import { register } from "register-service-worker"; |
|
4 |
|
|
5 |
if (process.env.NODE_ENV === "production") { |
|
6 |
register(`${process.env.BASE_URL}service-worker.js`, { |
|
7 |
ready() { |
|
8 |
console.log( |
|
9 |
"App is being served from cache by a service worker.\n" + |
|
10 |
"For more details, visit https://goo.gl/AFskqB" |
|
11 |
); |
|
12 |
}, |
|
13 |
cached() { |
|
14 |
console.log("Content has been cached for offline use."); |
|
15 |
}, |
|
16 |
updated() { |
|
17 |
console.log("New content is available; please refresh."); |
|
18 |
}, |
|
19 |
offline() { |
|
20 |
console.log( |
|
21 |
"No internet connection found. App is running in offline mode." |
|
22 |
); |
|
23 |
}, |
|
24 |
error(error) { |
|
25 |
console.error("Error during service worker registration:", error); |
|
26 |
} |
|
27 |
}); |
|
28 |
} |