- From: i18n-now <notifications@github.com>
- Date: Sun, 26 May 2024 16:39:56 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 26 May 2024 23:40:00 UTC
> controlling
> @jeffposnick
>
> > there could be a new promise, perhaps named .controlled
>
> This could be implemented as:
>
> ```js
> const p = new Promise(r => {
> if (navigator.serviceWorker.controller) return r();
> navigator.serviceWorker.addEventListener('controllerchange', e => r());
> });
> ```
>
> I think we need more evidence that this is a common enough pattern to add to the platform.
this not work when chrome refresh
I use this
```
<!DOCTYPE html><html><head><meta content="width=device-width,initial-scale=1" name="viewport"><meta charset="UTF-8"><script>(async S=>{await S.register("/S.js");S.controller?eval(await(await fetch("/_")).text()):location.reload()})(navigator.serviceWorker)</script></head><body></body></html>
```
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/799#issuecomment-2132434741
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/ServiceWorker/issues/799/2132434741@github.com>
Received on Sunday, 26 May 2024 23:40:00 UTC