Skip to content

Commit 12a1e1d

Browse files
committed
AAAA
1 parent 5e5b795 commit 12a1e1d

File tree

1 file changed

+16
-8
lines changed
  • source/_extensions/pwa_service_files

1 file changed

+16
-8
lines changed

source/_extensions/pwa_service_files/sw.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@ self.addEventListener('install', function(e) {
66
e.waitUntil(
77
caches.open('frc-docs').then(function(cache) {
88
fetch('_static/cache.json')
9-
.then(response => response.json().then(data => {
10-
/*for (const i of data) {
11-
cache.addAll()
12-
}*/
13-
cache.addAll(data).catch(error => {
9+
.then(response => response.json())
10+
.then(async (data) => {
11+
for (let i = 0; i < data.length / 10; i++) {
12+
const tofetch = data.slice(i * 10, i * 10 + 9)
13+
await cache.addAll(tofetch)
14+
}
15+
/*
16+
for (const i of data) {
17+
cache.add(i).catch(error => {
18+
console.error(i, error)
19+
})
20+
}
21+
(cache.addAll(data).catch(error => {
1422
console.error(error)
15-
})
16-
console.log(cache.keys());
17-
}))
23+
})*/
24+
//console.log(cache.keys());
25+
})
1826
.catch(error => {
1927
console.error(error);
2028
});

0 commit comments

Comments
 (0)