text: 
  console.log('Script loaded!')
  var cacheStorageKey = 'minimal-pwa-1'
  
  var cacheList = [
    '/',
    "index.html",
    "main.css",
    "tape.png",
    "data.json",
    "brython.js",
    "brython_dist.js",
    "clock.py",
    "pwa-fonts.png"
  ]
  
  self.addEventListener('install', function(e) {
    console.log('Cache event!')
    e.waitUntil(
      caches.open(cacheStorageKey).then(function(cache) {
        console.log('Adding to Cache:', cacheList)
        return cache.addAll(cacheList)
      }).then(function() {
        console.log('Skip waiting!')
        return self.skipWaiting()
      })
    )
  })
  
  self.addEventListener('activate', function(event) {
    console.log('Activate event')
    event.waitUntil(
      caches.keys().then(function(cacheNames) {
        return Promise.all(
          cacheNames.map(function(cacheName) {
            // 如果当前版本和缓存版本不一致
            if (cacheName !== cacheStorageKey) {
              console.log('Activate event: del cache')
              return caches.delete(cacheName);
            }
          })
        );
      })
    );
  });
  
  self.addEventListener('fetch', function(e) {
    // console.log('Fetch event:', e.request.url)
    e.respondWith(
      caches.match(e.request).then(function(response) {
        if (response != null) {
          console.log('Using cache for:', e.request.url)
          return response
        }
        console.log('Fallback to fetch:', e.request.url)
        return fetch(e.request.url)
      })
    )
  })
  