- From: Jake Archibald <notifications@github.com>
- Date: Mon, 03 Oct 2016 06:38:22 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Monday, 3 October 2016 13:38:56 UTC
Here's a rough polyfill for those looking for one:
```js
function regReady(reg) {
return new Promise((resolve, reject) => {
if (reg.active) {
resolve();
return;
}
if (!reg.installing && !reg.waiting) {
reject(Error('Install failed'));
return;
}
(reg.installing || reg.waiting).addEventListener('statechange', function() {
if (this.state == 'redundant') {
reject(Error('Install failed'));
} else if (this.state == 'activated') {
resolve();
}
});
});
}
```
--
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/770#issuecomment-251107543
Received on Monday, 3 October 2016 13:38:56 UTC