- From: dfabulich <notifications@github.com>
- Date: Thu, 14 Dec 2017 09:26:57 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 14 December 2017 17:27:19 UTC
Alerting users of a waiting service worker might look like this: ```js navigator.serviceWorker.ready.then(function(reg) { if (reg.waiting) alertUser(reg); reg.addEventListener('statechange', function(e) { if (e.target.state === 'waiting') alertUser(reg); }); }); ``` But I'd definitely prefer a `navigator.serviceWorker.waiting` promise for this common use case, as described in #1222. ```js navigator.serviceWorker.waiting.then(alertUser); ``` -- 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/1247#issuecomment-351780007
Received on Thursday, 14 December 2017 17:27:19 UTC