-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserviceWorker.js
190 lines (187 loc) · 6.73 KB
/
serviceWorker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
const staticACNHGuide = 'acnh-guide-site-v1';
const bugImages = [
'/assets/images/bugs/bugs_lqip.png',
'/assets/images/bugs/agriasButterfly.png',
'/assets/images/bugs/ant.png',
'/assets/images/bugs/atlasMoth.png',
'/assets/images/bugs/bagworm.png',
'/assets/images/bugs/bandedDragonfly.png',
'/assets/images/bugs/bellCricket.png',
'/assets/images/bugs/blueWeevilBeetle.png',
'/assets/images/bugs/brownCicada.png',
'/assets/images/bugs/centipede.png',
'/assets/images/bugs/cicadaShell.png',
'/assets/images/bugs/citrusLonghornedBeetle.png',
'/assets/images/bugs/commonBluebottle.png',
'/assets/images/bugs/commonButterfly.png',
'/assets/images/bugs/cricket.png',
'/assets/images/bugs/cyclommatusStag.png',
'/assets/images/bugs/damselfly.png',
'/assets/images/bugs/darnerDragonfly.png',
'/assets/images/bugs/divingBeetle.png',
'/assets/images/bugs/droneBeetle.png',
'/assets/images/bugs/dungBeetle.png',
'/assets/images/bugs/earthboringDungBeetle.png',
'/assets/images/bugs/emperorButterfly.png',
'/assets/images/bugs/eveningCicada.png',
'/assets/images/bugs/firefly.png',
'/assets/images/bugs/flea.png',
'/assets/images/bugs/fly.png',
'/assets/images/bugs/giantCicada.png',
'/assets/images/bugs/giantStag.png',
'/assets/images/bugs/goliathBeetle.png',
'/assets/images/bugs/grasshopper.png',
'/assets/images/bugs/greatPurpleEmperor.png',
'/assets/images/bugs/hermitCrab.png',
'/assets/images/bugs/honeybee.png',
'/assets/images/bugs/hornedAtlas.png',
'/assets/images/bugs/hornedDynastid.png',
'/assets/images/bugs/hornedElephant.png',
'/assets/images/bugs/hornedHercules.png',
'/assets/images/bugs/jewelBeetle.png',
'/assets/images/bugs/ladybug.png',
'/assets/images/bugs/longLocust.png',
'/assets/images/bugs/madagascanSunsetMoth.png',
'/assets/images/bugs/manfacedStinkBug.png',
'/assets/images/bugs/mantis.png',
'/assets/images/bugs/migratoryLocust.png',
'/assets/images/bugs/miyamaStag.png',
'/assets/images/bugs/moleCricket.png',
'/assets/images/bugs/monarchButterfly.png',
'/assets/images/bugs/mosquito.png',
'/assets/images/bugs/moth.png',
'/assets/images/bugs/orchidMantis.png',
'/assets/images/bugs/paperKiteButterfly.png',
'/assets/images/bugs/peacockButterfly.png',
'/assets/images/bugs/pillBug.png',
'/assets/images/bugs/pondSkater.png',
'/assets/images/bugs/queenAlexandrasBirdwing.png',
'/assets/images/bugs/rainbowStag.png',
'/assets/images/bugs/rajahBrookesBirdwing.png',
'/assets/images/bugs/redDragonfly.png',
'/assets/images/bugs/riceGrasshopper.png',
'/assets/images/bugs/robustCicada.png',
'/assets/images/bugs/rosaliaBatesiBeetle.png',
'/assets/images/bugs/sawStag.png',
'/assets/images/bugs/scarabBeetle.png',
'/assets/images/bugs/scorpion.png',
'/assets/images/bugs/snail.png',
'/assets/images/bugs/spider.png',
'/assets/images/bugs/stinkbug.png',
'/assets/images/bugs/tarantula.png',
'/assets/images/bugs/tigerBeetle.png',
'/assets/images/bugs/tigerButterfly.png',
'/assets/images/bugs/violinBeetle.png',
'/assets/images/bugs/walkerCicada.png',
'/assets/images/bugs/walkingLeaf.png',
'/assets/images/bugs/walkingStick.png',
'/assets/images/bugs/wasp.png',
'/assets/images/bugs/wharfRoach.png',
'/assets/images/bugs/yellowButterfly.png'
];
const fishImages = [
'/assets/images/fish/fish_lqip.png',
'/assets/images/fish/anchovy.png',
'/assets/images/fish/angelfish.png',
'/assets/images/fish/arapaima.png',
'/assets/images/fish/arowana.png',
'/assets/images/fish/barredKnifejaw.png',
'/assets/images/fish/barreleye.png',
'/assets/images/fish/betta.png',
'/assets/images/fish/bitterling.png',
'/assets/images/fish/blackBass.png',
'/assets/images/fish/blowfish.png',
'/assets/images/fish/bluegill.png',
'/assets/images/fish/blueMarlin.png',
'/assets/images/fish/butterflyFish.png',
'/assets/images/fish/carp.png',
'/assets/images/fish/catfish.png',
'/assets/images/fish/char.png',
'/assets/images/fish/cherrySalmon.png',
'/assets/images/fish/clownfish.png',
'/assets/images/fish/coelacanth.png',
'/assets/images/fish/crawfish.png',
'/assets/images/fish/crucianCarp.png',
'/assets/images/fish/dab.png',
'/assets/images/fish/dace.png',
'/assets/images/fish/dorado.png',
'/assets/images/fish/footballFish.png',
'/assets/images/fish/freshwaterGoby.png',
'/assets/images/fish/frog.png',
'/assets/images/fish/gar.png',
'/assets/images/fish/giantSnakehead.png',
'/assets/images/fish/giantTrevally.png',
'/assets/images/fish/goldenTrout.png',
'/assets/images/fish/goldfish.png',
'/assets/images/fish/greatWhiteShark.png',
'/assets/images/fish/guppy.png',
'/assets/images/fish/hammerheadShark.png',
'/assets/images/fish/horseMackerel.png',
'/assets/images/fish/killifish.png',
'/assets/images/fish/kingSalmon.png',
'/assets/images/fish/koi.png',
'/assets/images/fish/loach.png',
'/assets/images/fish/mahiMahi.png',
'/assets/images/fish/mittenCrab.png',
'/assets/images/fish/morayEel.png',
'/assets/images/fish/napoleonfish.png',
'/assets/images/fish/neonTetra.png',
'/assets/images/fish/nibbleFish.png',
'/assets/images/fish/oarfish.png',
'/assets/images/fish/oceanSunfish.png',
'/assets/images/fish/oliveFlounder.png',
'/assets/images/fish/paleChub.png',
'/assets/images/fish/pike.png',
'/assets/images/fish/piranha.png',
'/assets/images/fish/pondSmelt.png',
'/assets/images/fish/popeyedGoldfish.png',
'/assets/images/fish/pufferFish.png',
'/assets/images/fish/rainbowfish.png',
'/assets/images/fish/ranchuGoldfish.png',
'/assets/images/fish/ray.png',
'/assets/images/fish/redSnapper.png',
'/assets/images/fish/ribbonEel.png',
'/assets/images/fish/saddledBichir.png',
'/assets/images/fish/salmon.png',
'/assets/images/fish/sawShark.png',
'/assets/images/fish/seaBass.png',
'/assets/images/fish/seaButterfly.png',
'/assets/images/fish/seaHorse.png',
'/assets/images/fish/snappingTurtle.png',
'/assets/images/fish/softshelledTurtle.png',
'/assets/images/fish/squid.png',
'/assets/images/fish/stringfish.png',
'/assets/images/fish/sturgeon.png',
'/assets/images/fish/suckerfish.png',
'/assets/images/fish/surgeonfish.png',
'/assets/images/fish/sweetfish.png',
'/assets/images/fish/tadpole.png',
'/assets/images/fish/tilapia.png',
'/assets/images/fish/tuna.png',
'/assets/images/fish/whaleShark.png',
'/assets/images/fish/yellowPerch.png',
'/assets/images/fish/zebraTurkeyfish.png'
];
const assets = [
'/',
'/index.html',
'/assets/css/reset.min.css',
'/assets/css/style.min.css',
'/assets/js/bugs.min.js',
'/assets/js/fish.min.js',
'/assets/js/script.min.js',
'/assets/images/acnh_logo@2x.png',
'/assets/images/leaf-print.png',
...bugImages,
...fishImages
];
self.addEventListener('install', e => {
e.waitUntil(
caches.open(staticACNHGuide).then(cache => cache.addAll(assets))
);
});
self.addEventListener('fetch', e => {
e.respondWith(
caches.match(e.request).then(res => res || fetch(e.request))
);
});