File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 66 * Register service worker.
77 * ========================================================== */
88
9- const PRECACHE = 'precache-v1' ;
10- const RUNTIME = 'runtime' ;
9+ // CACHE_NAMESPACE
10+ // CacheStorage is shared between all sites under same domain.
11+ // A namespace can prevent potential name conflicts and mis-deletion.
12+ const CACHE_NAMESPACE = 'main-'
13+
14+ const PRECACHE = CACHE_NAMESPACE + 'precache-v1' ;
15+ const RUNTIME = CACHE_NAMESPACE + 'runtime' ;
1116const HOSTNAME_WHITELIST = [
1217 self . location . hostname ,
1318 "huangxuan.me" ,
@@ -94,6 +99,7 @@ self.addEventListener('install', e => {
9499 * waitUntil(): activating ====> activated
95100 */
96101self . addEventListener ( 'activate' , event => {
102+ // TODO: consider some cleanning up.
97103 console . log ( 'service worker activated.' )
98104 event . waitUntil ( self . clients . claim ( ) ) ;
99105} ) ;
You can’t perform that action at this time.
0 commit comments