-
Notifications
You must be signed in to change notification settings - Fork 0
/
serviceWorker.js
216 lines (208 loc) · 11.3 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
const staticPyPWA = "dev-pypwa-v4"
const assets = [
"/static/images/icons/icon-72x72.png",
"/static/images/icons/icon-92x96.png",
"/static/images/icons/icon-128x128.png",
"/static/images/icons/icon-144x144.png",
"/static/images/icons/icon-152x152.png",
"/static/images/icons/icon-192x192.png",
"/static/images/icons/icon-384x384.png",
"/static/images/icons/icon-512x512.png",
"/static/js/pwa-scaffold.js",
"/static/js/get_user_media.js",
"/static/python/main.py",
"/static/python/image_processing.py",
"/static/pyscript/pyscript.css",
"/static/pyscript/pyscript.js",
"/static/pyscript/pyscript.py",
"/static/pyodide/pyodide.js",
"/static/pyodide/package.json",
"/static/pyodide/pyodide_py.tar",
"/static/pyodide/pyodide.asm.js",
"/static/pyodide/pyodide.asm.data",
"/static/pyodide/pyodide.asm.wasm",
"/static/pyodide/asciitree-0.3.3-py3-none-any.whl",
"/static/pyodide/astropy-5.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/atomicwrites-1.4.0-py2.py3-none-any.whl",
"/static/pyodide/attrs-21.4.0-py2.py3-none-any.whl",
"/static/pyodide/autograd-1.4-py3-none-any.whl",
"/static/pyodide/autograd-tests.tar",
"/static/pyodide/beautifulsoup4-4.11.1-py3-none-any.whl",
"/static/pyodide/beautifulsoup4-tests.tar",
"/static/pyodide/biopython-1.79-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/bitarray-2.5.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/bitarray-tests.tar",
"/static/pyodide/bleach-5.0.0-py3-none-any.whl",
"/static/pyodide/bokeh-2.4.3-py3-none-any.whl",
"/static/pyodide/boost_histogram-1.3.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/certifi-2022.6.15-py3-none-any.whl",
"/static/pyodide/cffi-1.15.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/cffi_example-0.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/cftime-1.6.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/CLAPACK-3.2.1.zip",
"/static/pyodide/cloudpickle-2.1.0-py3-none-any.whl",
"/static/pyodide/cmyt-1.0.4-py3-none-any.whl",
"/static/pyodide/cmyt-tests.tar",
"/static/pyodide/colorspacious-1.1.2-py2.py3-none-any.whl",
"/static/pyodide/cpp-exceptions-test-0.1.zip",
"/static/pyodide/cryptography-37.0.3-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/cssselect-1.1.0-py2.py3-none-any.whl",
"/static/pyodide/cycler-0.11.0-py3-none-any.whl",
"/static/pyodide/cytoolz-0.11.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/cytoolz-tests.tar",
"/static/pyodide/decorator-5.1.1-py3-none-any.whl",
"/static/pyodide/demes-0.2.2-py3-none-any.whl",
"/static/pyodide/distlib-0.3.4-py2.py3-none-any.whl",
"/static/pyodide/distutils.tar",
"/static/pyodide/docutils-0.18.1-py2.py3-none-any.whl",
"/static/pyodide/fonttools-4.33.3-py3-none-any.whl",
"/static/pyodide/fpcast_test-0.1.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/freesasa-2.1.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/future-0.18.2-py3-none-any.whl",
"/static/pyodide/future-tests.tar",
"/static/pyodide/galpy-1.8.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/geos-3.10.3.zip",
"/static/pyodide/gmpy2-2.1.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/gsw-3.4.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/gsw-tests.tar",
"/static/pyodide/html5lib-1.1-py2.py3-none-any.whl",
"/static/pyodide/imageio-2.19.3-py3-none-any.whl",
"/static/pyodide/iniconfig-1.1.1-py2.py3-none-any.whl",
"/static/pyodide/jedi-0.18.1-py2.py3-none-any.whl",
"/static/pyodide/jedi-tests.tar",
"/static/pyodide/Jinja2-3.1.2-py3-none-any.whl",
"/static/pyodide/joblib-1.1.0-py2.py3-none-any.whl",
"/static/pyodide/joblib-tests.tar",
"/static/pyodide/jsonschema-4.6.0-py3-none-any.whl",
"/static/pyodide/jsonschema-tests.tar",
"/static/pyodide/kiwisolver-1.4.3-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/lazy_object_proxy-1.7.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/Logbook-1.5.3-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/lxml-4.9.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/MarkupSafe-2.1.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/matplotlib-3.5.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/matplotlib-tests.tar",
"/static/pyodide/micropip-0.1-py3-none-any.whl",
"/static/pyodide/mne-1.0.3-py3-none-any.whl",
"/static/pyodide/mne-tests.tar",
"/static/pyodide/more_itertools-8.13.0-py3-none-any.whl",
"/static/pyodide/mpmath-1.2.1-py3-none-any.whl",
"/static/pyodide/mpmath-tests.tar",
"/static/pyodide/msgpack-1.0.4-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/msprime-1.2.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/networkx-2.8.4-py3-none-any.whl",
"/static/pyodide/networkx-tests.tar",
"/static/pyodide/newick-1.3.2-py2.py3-none-any.whl",
"/static/pyodide/nlopt-2.7.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/nltk-3.7-py3-none-any.whl",
"/static/pyodide/nltk-tests.tar",
"/static/pyodide/nose-1.3.7-py3-none-any.whl",
"/static/pyodide/numcodecs-0.9.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/numcodecs-tests.tar",
"/static/pyodide/numpy-1.22.4-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/numpy-tests.tar",
"/static/pyodide/opencv_python-4.6.0.66-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/openssl-1.1.1n.zip",
"/static/pyodide/optlang-1.5.2-py2.py3-none-any.whl",
"/static/pyodide/optlang-tests.tar",
"/static/pyodide/packaging-21.3-py3-none-any.whl",
"/static/pyodide/pandas-1.4.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pandas-tests.tar",
"/static/pyodide/parso-0.8.3-py2.py3-none-any.whl",
"/static/pyodide/patsy-0.5.2-py2.py3-none-any.whl",
"/static/pyodide/patsy-tests.tar",
"/static/pyodide/PIL-9.1.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pkgconfig-1.5.5-py3-none-any.whl",
"/static/pyodide/pluggy-1.0.0-py2.py3-none-any.whl",
"/static/pyodide/py-1.11.0-py2.py3-none-any.whl",
"/static/pyodide/b2d-0.7.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pycparser-2.21-py2.py3-none-any.whl",
"/static/pyodide/pydantic-1.9.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pyerfa-2.0.0.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pyerfa-tests.tar",
"/static/pyodide/Pygments-2.12.0-py3-none-any.whl",
"/static/pyodide/pyparsing-3.0.9-py3-none-any.whl",
"/static/pyodide/pyproj-3.3.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pyrsistent-0.18.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pytest-7.1.2-py3-none-any.whl",
"/static/pyodide/pytest_benchmark-3.4.1-py2.py3-none-any.whl",
"/static/pyodide/python_dateutil-2.8.2-py2.py3-none-any.whl",
"/static/pyodide/python_sat-0.1.7.dev19-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/python_solvespace-3.0.7-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pytz-2022.1-py2.py3-none-any.whl",
"/static/pyodide/PyWavelets-1.3.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/pywavelets-tests.tar",
"/static/pyodide/PyYAML-6.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/regex-2022.6.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/regex-tests.tar",
"/static/pyodide/retrying-1.3.3-py3-none-any.whl",
"/static/pyodide/RobotRaconteur-0.15.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/ruamel.yaml-0.17.21-py3-none-any.whl",
"/static/pyodide/scikit_image-0.19.3-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/scikit-image-tests.tar",
"/static/pyodide/scikit_learn-1.1.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/scikit-learn-tests.tar",
"/static/pyodide/scipy-1.8.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/scipy-tests.tar",
"/static/pyodide/setuptools-62.6.0-py3-none-any.whl",
"/static/pyodide/Shapely-1.8.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/shapely-tests.tar",
"/static/pyodide/sharedlib-test-1.0.zip",
"/static/pyodide/sharedlib_test_py-1.0-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/six-1.16.0-py2.py3-none-any.whl",
"/static/pyodide/soupsieve-2.3.2.post1-py3-none-any.whl",
"/static/pyodide/sparseqr-1.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/SQLAlchemy-1.4.37-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/sqlalchemy-tests.tar",
"/static/pyodide/ssl-1.0.0.zip",
"/static/pyodide/statsmodels-0.13.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/statsmodels-tests.tar",
"/static/pyodide/suitesparse-5.11.0.zip",
"/static/pyodide/svgwrite-1.4.2-py3-none-any.whl",
"/static/pyodide/swiglpk-5.0.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/sympy-1.10.1-py3-none-any.whl",
"/static/pyodide/sympy-tests.tar",
"/static/pyodide/tblib-1.7.0-py2.py3-none-any.whl",
"/static/pyodide/termcolor-1.1.0-py3-none-any.whl",
"/static/pyodide/test.tar",
"/static/pyodide/threadpoolctl-3.1.0-py3-none-any.whl",
"/static/pyodide/tomli-2.0.1-py3-none-any.whl",
"/static/pyodide/tomli_w-1.0.0-py3-none-any.whl",
"/static/pyodide/toolz-0.11.2-py3-none-any.whl",
"/static/pyodide/toolz-tests.tar",
"/static/pyodide/tqdm-4.64.0-py2.py3-none-any.whl",
"/static/pyodide/traits-6.3.2-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/traits-tests.tar",
"/static/pyodide/tskit-0.4.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/typing_extensions-4.2.0-py3-none-any.whl",
"/static/pyodide/uncertainties-3.1.7-py2.py3-none-any.whl",
"/static/pyodide/uncertainties-tests.tar",
"/static/pyodide/unyt-2.8.0-py2.py3-none-any.whl",
"/static/pyodide/unyt-tests.tar",
"/static/pyodide/webencodings-0.5.1-py2.py3-none-any.whl",
"/static/pyodide/wrapt-1.14.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/xarray-2022.3.0-py3-none-any.whl",
"/static/pyodide/xarray-tests.tar",
"/static/pyodide/xgboost-1.6.1-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/xlrd-2.0.1-py2.py3-none-any.whl",
"/static/pyodide/yt-4.0.4-cp310-cp310-emscripten_3_1_14_wasm32.whl",
"/static/pyodide/zarr-2.11.3-py3-none-any.whl",
"/static/pyodide/zarr-tests.tar",
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticPyPWA).then(cache => {
cache.addAll(assets).then(r => {
console.log("Cache assets downloaded");
}).catch(err => console.log("Error caching item", err))
console.log(`Cache ${staticPyPWA} opened.`);
}).catch(err => console.log("Error opening cache", err))
)
})
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
}).catch(err => console.log("Cache fetch error: ", err))
)
})