- From: Arthur Stolyar <notifications@github.com>
- Date: Mon, 24 Oct 2016 16:19:40 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Monday, 24 October 2016 23:20:09 UTC
Given latest comments in https://github.com/w3c/ServiceWorker/issues/920 I got some thoughts that it would be good to pass `async function` directly into `fetch` event.
My questions is: is `waitUntil` automatically called when `async function` is used as an listener?
I would expect this to work:
```js
self.addEventListener('fetch', async function(e) {
const preload = await e.navigationPreload;
if (preload) {
e.respondWith(preload);
}
});
```
with manual `waitUntil` it needs to be:
```js
self.addEventListener('fetch', async function(e) {
let preload = e.navigationPreload;
e.waitUntil(preload);
preload = await preload;
if (preload) {
e.respondWith(preload);
}
});
```
--
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/997
Received on Monday, 24 October 2016 23:20:09 UTC