Re: [w3c/ServiceWorker] Declarative routing (#1373)

it'd be the same for both online and offline. Assuming all routes point to the cache firs - if it's an online asset, replace with net when available. same for offline, just the timeout for the cache with online data would be 0ms / fetch onSomeUserEvent compared something like a 24 hour reset for offline stuff. I think a harder thing to overcome would be designating stuff as something like 'use last successful' vs 'use constant fallback' , Proxy.revoke() with your conditional checks on propkeys access could probably handle everything needed. 

```js
router.get(
  new RouterIfURLPrefix('/**/*.jpg/'),   // If the URL ends in jpg'.
  new RouterSourceCache(),   //Otherwise, try to match the request in the cache.
  new RouterSourceNetwork(),   //Try to fetch the request from the network.   <-- this doesn't need to come first for online reqs , just use the current value in the cache first and always
```
somewhat unrelated but really what underpins my line of thinking is that I feel like offline apps should basically be completely downloaded into some form of local storage on 1st req, and the SW routes should support coding against the offline assets more-so than online sources. 

-- 
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/1373#issuecomment-455220712

Received on Thursday, 17 January 2019 15:49:15 UTC