fast claim all clients

This commit is contained in:
Pooya Parsa 2020-11-04 00:13:45 +01:00
parent a8db45a8ba
commit c43cf33c95

View File

@ -11,6 +11,16 @@ addEventListener('fetch', (event: any) => {
event.respondWith(handleEvent(url, event.request))
})
self.addEventListener('install', () => {
// @ts-ignore
self.skipWaiting()
})
self.addEventListener('activate', (event) => {
// @ts-ignore
event.waitUntil(self.clients.claim())
})
async function handleEvent (url, request) {
try {
const { html, status, headers } = await render(url.pathname, { req: request })