blob: fd754f8250da0a0464b960767f9e7ab97f5274b4 (
plain)
1
2
3
4
5
6
7
8
9
10
|
addEventListener('fetch', e => {
if (e.request.url.includes('get-worker-client-url')) {
e.respondWith((async () => {
const clients = await self.clients.matchAll({type: 'worker'});
if (clients.length != 1)
return new Response('one worker client should exist');
return new Response(clients[0].url);
})());
}
});
|