- From: Surma <notifications@github.com>
- Date: Wed, 08 Feb 2017 06:15:38 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 8 February 2017 14:16:16 UTC
To clarify, the problem I have is the following:
The following code will add `index.html` and `styles.css` to my cache:
```js
self.oninstall = event => {
event.waitUntil(async function() {
const cache = await caches.open('mycache');
await cache.addAll(['index.html', 'styles.css']);
}());
}
```
The following code will do _nothing_:
```js
self.oninstall = event => {
event.waitUntil(async function() {
const cache = await caches.open('mycache');
await cache.addAll(['index.html', 'styles.css']);
});
}
```
The only difference is that I forgot to invoke my async function literal. I would like to somehow catch that.
> Maybe we just need to push a pattern like:
I guess we could try solving this by pushing best practices, but I feel like there’s barely ever a use-case where the value passed to `waitUntil` is anything else but a promise[citation needed]. I do understand @annevk that IDL does not allow us to inspect the value passed to `waitUntil`, but I’d still like us to at least think about if there’s a feasible solution to making this error for developers’ sake.
--
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/1068#issuecomment-278339634
Received on Wednesday, 8 February 2017 14:16:16 UTC