Disable ServiceWorker
This commit is contained in:
		
							parent
							
								
									abf11bb03c
								
							
						
					
					
						commit
						289c76a802
					
				
					 2 changed files with 4 additions and 39 deletions
				
			
		|  | @ -173,9 +173,10 @@ export default class MiOS extends EventEmitter { | |||
| 
 | ||||
| 			// Init service worker
 | ||||
| 			if (this.shouldRegisterSw) { | ||||
| 				this.getMeta().then(data => { | ||||
| 					this.registerSw(data.swPublickey); | ||||
| 				}); | ||||
| 				// #4813
 | ||||
| 				//this.getMeta().then(data => {
 | ||||
| 				//	this.registerSw(data.swPublickey);
 | ||||
| 				//});
 | ||||
| 			} | ||||
| 		}; | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,12 +3,6 @@ | |||
|  */ | ||||
| 
 | ||||
| import composeNotification from './common/scripts/compose-notification'; | ||||
| import { erase } from '../../prelude/array'; | ||||
| 
 | ||||
| // キャッシュするリソース
 | ||||
| const cachee = [ | ||||
| 	'/' | ||||
| ]; | ||||
| 
 | ||||
| // インストールされたとき
 | ||||
| self.addEventListener('install', ev => { | ||||
|  | @ -16,31 +10,9 @@ self.addEventListener('install', ev => { | |||
| 
 | ||||
| 	ev.waitUntil(Promise.all([ | ||||
| 		self.skipWaiting(), // Force activate
 | ||||
| 		caches.open(_VERSION_).then(cache => cache.addAll(cachee)) // Cache
 | ||||
| 	])); | ||||
| }); | ||||
| 
 | ||||
| // アクティベートされたとき
 | ||||
| self.addEventListener('activate', ev => { | ||||
| 	// Clean up old caches
 | ||||
| 	ev.waitUntil( | ||||
| 		caches.keys().then(keys => Promise.all( | ||||
| 			erase(_VERSION_, keys) | ||||
| 				.map(key => caches.delete(key)) | ||||
| 		)) | ||||
| 	); | ||||
| }); | ||||
| 
 | ||||
| // リクエストが発生したとき
 | ||||
| self.addEventListener('fetch', ev => { | ||||
| 	ev.respondWith( | ||||
| 		// キャッシュがあるか確認してあればそれを返す
 | ||||
| 		caches.match(ev.request).then(response => | ||||
| 			response || fetch(ev.request) | ||||
| 		) | ||||
| 	); | ||||
| }); | ||||
| 
 | ||||
| // プッシュ通知を受け取ったとき
 | ||||
| self.addEventListener('push', ev => { | ||||
| 	// クライアント取得
 | ||||
|  | @ -59,11 +31,3 @@ self.addEventListener('push', ev => { | |||
| 		}); | ||||
| 	})); | ||||
| }); | ||||
| 
 | ||||
| self.addEventListener('message', ev => { | ||||
| 	if (ev.data == 'clear') { | ||||
| 		caches.keys().then(keys => { | ||||
| 			for (const key of keys) caches.delete(key); | ||||
| 		}); | ||||
| 	} | ||||
| }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue