self.addEventListener('install', function(e) {
    e.waitUntil(
        caches.open('daily-kanji').then(function(cache) {
            return cache.addAll([
                '/daily-kanji/',
                '/daily-kanji/index.html',
                '/daily-kanji/main.js',
                '/daily-kanji/style.css'
            ]);
        })
    );
});

self.addEventListener('fetch', function(event) {
    event.respondWith(
        caches.match(event.request).then(function(response) {
            return response || fetch(event.request);
        })
    );
});