mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-22 00:06:30 -05:00
Wait for promise resolution
This commit is contained in:
parent
b84102ea4b
commit
fd496d7cdd
1 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,7 @@ function cacheClients() {
|
|||
includeUncontrolled: true
|
||||
})
|
||||
.then(allClients => allClients.map(client => client.url))
|
||||
.then(pages => [pages, caches.open(cacheName)])
|
||||
.then(pages => Promise.all([pages, caches.open(cacheName)]))
|
||||
.then(([pages, cache]) => cache.addAll(pages))
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ function clearInvalidatedCaches() {
|
|||
|
||||
function trimCache(name, maxItems) {
|
||||
return caches.open(name)
|
||||
.then(cache => [cache, cache.keys()])
|
||||
.then(cache => Promise.all([cache, cache.keys()]))
|
||||
// Make sure offlineFundamentals don't get deleted
|
||||
.then(([cache, keys]) => [cache, keys.filter(key => !offlineFundamentals.includes(key))])
|
||||
.then(([cache, possibleDelete]) => {
|
||||
|
|
Loading…
Reference in a new issue