-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoly.js
38 lines (36 loc) · 1.05 KB
/
poly.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
(function() {
const c = {
add: function(url) {
const that = this;
fetch(url).then(function(response) {
if (!response.ok) {
throw new TypeError('bad response status');
}
return that.put(url, response);
})
},
addAll: function (urls) {
for (const u of urls) {
this.add(u);
}
return Promise.resolve(void 0)
},
put: () => Promise.resolve(void 0),
match: () => Promise.resolve(void 0),
matchAll: () => Promise.resolve([]),
keys: () => Promise.resolve([]),
};
if (typeof caches === 'undefined') {
globalThis.caches = {
default: c,
open: () => Promise.resolve(c),
has: () => true,
keys: () => Promise.resolve([]),
};
}
if (typeof Deno !== 'undefined') {
for (const [k, v] of Object.entries(Deno.env.toObject())) {
globalThis[k] = v;
}
}
})();