Dynamic Cache Attempt
Bump to testing
This commit is contained in:
parent
8335365bbf
commit
97c940cc44
@ -1,5 +1,5 @@
|
|||||||
/* All Page Init */
|
/* All Page Init */
|
||||||
const version = '2.0.0-rc'
|
const version = '2.0.0-testing'
|
||||||
|
|
||||||
/* Feature Detectors */
|
/* Feature Detectors */
|
||||||
|
|
||||||
|
67
sw.js
67
sw.js
@ -1,40 +1,13 @@
|
|||||||
/* Service Worker */
|
/* Service Worker */
|
||||||
|
|
||||||
const appVersion = 'PIS-DEV-0105002'
|
const appVersion = '2.0.0-test'
|
||||||
const cacheName = `owlboard-${appVersion}`
|
const cacheName = `owlboard-${appVersion}`
|
||||||
const cacheIDs = [cacheName]
|
const cacheIDs = [cacheName]
|
||||||
const cacheFiles = [
|
const staticCache = [
|
||||||
'/404.html',
|
|
||||||
'/auth.html',
|
|
||||||
'/board.html',
|
|
||||||
'/conn-err.html',
|
|
||||||
'/help.html',
|
|
||||||
'/',
|
|
||||||
'/issue.html',
|
|
||||||
'/find-code.html',
|
|
||||||
'/settings.html',
|
|
||||||
'/pis.html',
|
|
||||||
'/manifest.json',
|
|
||||||
'/styles/fonts/firamono/firamono-500.woff2',
|
'/styles/fonts/firamono/firamono-500.woff2',
|
||||||
'/styles/fonts/firamono/firamono-regular.woff2',
|
'/styles/fonts/firamono/firamono-regular.woff2',
|
||||||
'/styles/fonts/urwgothic/urwgothic.woff2',
|
'/styles/fonts/urwgothic/urwgothic.woff2',
|
||||||
'/styles/fonts/urwgothic/urwgothicDemi.woff2',
|
'/styles/fonts/urwgothic/urwgothicDemi.woff2',
|
||||||
'/styles/board.css',
|
|
||||||
'/styles/find-code.css',
|
|
||||||
'/styles/help.css',
|
|
||||||
'/styles/issue.css',
|
|
||||||
'/styles/main.css',
|
|
||||||
'/styles/settings.css',
|
|
||||||
'/styles/pis.css',
|
|
||||||
'/js/find-code.js',
|
|
||||||
'/js/index.js',
|
|
||||||
'/js/issue.js',
|
|
||||||
'/js/lib.board.js',
|
|
||||||
'/js/lib.main.js',
|
|
||||||
'/js/auth.js',
|
|
||||||
'/js/settings.js',
|
|
||||||
'/js/simple-board.js',
|
|
||||||
'/js/pis.js',
|
|
||||||
'/images/icon.svg',
|
'/images/icon.svg',
|
||||||
'/images/logo/wide_logo.svg',
|
'/images/logo/wide_logo.svg',
|
||||||
'/images/logo/mono-logo.svg',
|
'/images/logo/mono-logo.svg',
|
||||||
@ -50,6 +23,40 @@ const cacheFiles = [
|
|||||||
'/images/nre/nre-powered_400w.webp',
|
'/images/nre/nre-powered_400w.webp',
|
||||||
'/images/nre/nre-powered_400w.jxl'
|
'/images/nre/nre-powered_400w.jxl'
|
||||||
]
|
]
|
||||||
|
const dynamicCache = [
|
||||||
|
'/404.html',
|
||||||
|
'/auth.html',
|
||||||
|
'/board.html',
|
||||||
|
'/conn-err.html',
|
||||||
|
'/help.html',
|
||||||
|
'/',
|
||||||
|
'/issue.html',
|
||||||
|
'/find-code.html',
|
||||||
|
'/settings.html',
|
||||||
|
'/pis.html',
|
||||||
|
'/manifest.json',
|
||||||
|
'/styles/board.css',
|
||||||
|
'/styles/find-code.css',
|
||||||
|
'/styles/help.css',
|
||||||
|
'/styles/issue.css',
|
||||||
|
'/styles/main.css',
|
||||||
|
'/styles/settings.css',
|
||||||
|
'/styles/pis.css',
|
||||||
|
'/js/find-code.js',
|
||||||
|
'/js/index.js',
|
||||||
|
'/js/issue.js',
|
||||||
|
'/js/lib.board.js',
|
||||||
|
'/js/lib.main.js',
|
||||||
|
'/js/auth.js',
|
||||||
|
'/js/settings.js',
|
||||||
|
'/js/simple-board.js',
|
||||||
|
'/js/pis.js'
|
||||||
|
]
|
||||||
|
|
||||||
|
for(let i = 0; i < dynamicCache.length; i++) {
|
||||||
|
let item = dynamicCache[i] + `?${appVersion}`
|
||||||
|
staticCache.push(item)
|
||||||
|
}
|
||||||
|
|
||||||
self.addEventListener('install', (e) => {
|
self.addEventListener('install', (e) => {
|
||||||
console.log('[Service Worker] Install')
|
console.log('[Service Worker] Install')
|
||||||
@ -57,7 +64,7 @@ self.addEventListener('install', (e) => {
|
|||||||
(async () => {
|
(async () => {
|
||||||
const cache = await caches.open(cacheName)
|
const cache = await caches.open(cacheName)
|
||||||
console.log('[Service Worker] Caching app data')
|
console.log('[Service Worker] Caching app data')
|
||||||
await cache.addAll(cacheFiles)
|
await cache.addAll(staticCache)
|
||||||
})()
|
})()
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user