Docs

Read offline

resource() tells Eidos which GETs to cache. Supporting feature — Save is still the hero.

Next: When things break →

Declare a read

products.ts
import { resource } from '@sweidos/eidos'
export const products = resource('/api/products', {
offline: true, // cache + SW interception
})
const list = await products.json<Product[]>()
  • offline: true defaults to stale-while-revalidate (fast + refresh in background).
  • Override strategy with cache-first, network-first, or stale-while-revalidate.
  • Same handle: products.fetch(), .json(), .prefetch(), .invalidate().

Many URLs, one registration

patterns
import { resourcePattern } from '@sweidos/eidos'
export const productPages = resourcePattern('/api/products/*', {
offline: true,
})

Patterns are for Service Worker interception — use invalidate() to clear matches. See Recipes for live examples.

Inspect cached reads

Open resources lab