sw.js 475 B

1234567891011121314151617181920212223
  1. /**
  2. * service worker
  3. */
  4. var cacheName = '';
  5. var apiCacheName = '';
  6. var cacheFiles = [
  7. '/'
  8. ];
  9. // 监听install事件
  10. self.addEventListener('install', function (e) {
  11. console.log('Service Worker 状态: install');
  12. });
  13. // 监听activate事件
  14. self.addEventListener('activate', function (e) {
  15. console.log('Service Worker 状态: activate');
  16. });
  17. self.addEventListener('fetch', function (e) {
  18. // 需要缓存的xhr请求
  19. console.log("fetch 事件")
  20. });