mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
fast claim all clients
This commit is contained in:
parent
a8db45a8ba
commit
c43cf33c95
@ -11,6 +11,16 @@ addEventListener('fetch', (event: any) => {
|
|||||||
event.respondWith(handleEvent(url, event.request))
|
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) {
|
async function handleEvent (url, request) {
|
||||||
try {
|
try {
|
||||||
const { html, status, headers } = await render(url.pathname, { req: request })
|
const { html, status, headers } = await render(url.pathname, { req: request })
|
||||||
|
Loading…
Reference in New Issue
Block a user