- From: Stephen Blum <notifications@github.com>
- Date: Thu, 30 Sep 2021 11:21:50 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 30 September 2021 18:22:03 UTC
> @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 solved our issue. Thank you :+1:
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/799#issuecomment-931557960
Received on Thursday, 30 September 2021 18:22:03 UTC