Re: [whatwg/fetch] Add `json` to RequestDestination values (#1042)

@annevk 

hi,

I'm currently using [Google Workbox](https://github.com/GoogleChrome/workbox) and our [PWA](https://web.dev/progressive-web-apps/), uses `json` files for the **content and semantic** data files for our `web 3.0` stuff.

We want to increase performance and add a `cache-first` strategy for our content json files in our pwa.

A code example would look like this:

```
import { registerRoute } from "workbox-routing";
import { ExpirationPlugin } from "workbox-expiration";

registerRoute(
    ({ request }) => request.destination === "json",
    new CacheFirst({
        cacheName: "json",
        plugins: [
            new ExpirationPlugin({
                maxEntries: 60,
                maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
            }),
        ],
    })
);
```

Link to more examples: https://developers.google.com/web/tools/workbox/guides/common-recipes

Hope that helps for an example use case.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1042#issuecomment-649451631

Received on Thursday, 25 June 2020 10:23:26 UTC