我是服务人员的新手。我正在尝试实现静态和动态缓存。
当我将单个文件添加到静态缓存请求时,它会占用我拥有的所有文件。目前,当我从离线模式启动时,所有文件都从服务工作者运行。请有人帮助我。
这是我在 index.html 中的代码。
self.addEventListener('install',function(event)
{
console.log('[service worker]Installing service
worker....',event);
event.waitUntil(caches.open('static')
.then(function(cache)
{
console.log('[Service Worker] Precaching App Shell');
cache.addAll([
'/',
'/signin.html',
]);
})
)
});