Skip to content

Commit 9e566b2

Browse files
authored
Merge pull request #387 from LinusU/prefer-const
Prefer const over let
2 parents 39d635e + 9754d43 commit 9e566b2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

static/service-worker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// Incrementing CACHE_VERSION will kick off the install event and force previously cached
66
// resources to be cached again.
77
const CACHE_VERSION = 1
8-
let CURRENT_CACHES = {
8+
const CURRENT_CACHES = {
99
offline: 'offline-v' + CACHE_VERSION
1010
}
1111
const OFFLINE_URL = 'offline.html'
1212

1313
function createCacheBustedRequest (url) {
14-
let request = new Request(url, { cache: 'reload' })
14+
const request = new Request(url, { cache: 'reload' })
1515
// See https://fetch.spec.whatwg.org/#concept-request-mode
1616
// This is not yet supported in Chrome as of M48, so we need to explicitly check to see
1717
// if the cache: 'reload' option had any effect.
@@ -20,7 +20,7 @@ function createCacheBustedRequest (url) {
2020
}
2121

2222
// If {cache: 'reload'} didn't have any effect, append a cache-busting URL parameter instead.
23-
let bustedUrl = new URL(url, self.location.href)
23+
const bustedUrl = new URL(url, self.location.href)
2424
bustedUrl.search += (bustedUrl.search ? '&' : '') + 'cachebust=' + Date.now()
2525
return new Request(bustedUrl)
2626
}
@@ -41,7 +41,7 @@ self.addEventListener('activate', event => {
4141
// Delete all caches that aren't named in CURRENT_CACHES.
4242
// While there is only one cache in this example, the same logic will handle the case where
4343
// there are multiple versioned caches.
44-
let expectedCacheNames = Object.keys(CURRENT_CACHES).map(function (key) {
44+
const expectedCacheNames = Object.keys(CURRENT_CACHES).map(function (key) {
4545
return CURRENT_CACHES[key]
4646
})
4747

0 commit comments

Comments
 (0)