blob: 890e51f1b953b4dc11bd78d7323da7e55557b161 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const name = 'test_cache';
const resource = '/service_worker/v8_cache_test.js';
self.addEventListener('install', evt => {
evt.waitUntil(async function() {
const c = await caches.open(name);
await c.addAll([resource]);
}());
});
self.addEventListener('fetch', evt => {
evt.respondWith(async function() {
const c = await caches.open(name);
return c.match(resource);
}());
});