Guest User

Untitled

a guest
Jan 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. 'use strict';
  2.  
  3. self.addEventListener('install', function(){
  4. self.skipWaiting();
  5. });
  6.  
  7. self.addEventListener('activate', function(){
  8. // delete all caches
  9. self.caches
  10. .keys()
  11. .then(function(keyList){
  12. return Promise.all(keyList.map(function(key){ return self.caches.delete(key) }))
  13. })
  14. .then(() =>
  15. self.clients.matchAll().then(function(clients){
  16. clients.forEach(function(client) => {
  17. client.postMessage({type: 'versionCheck', version: 'killswitch'})
  18. });
  19. })
  20. )
  21. .then(function(){
  22. // unregister self
  23. self.registration.unregister();
  24. });
  25. });
Add Comment
Please, Sign In to add comment