Primitives / foldkit-primitives/media

MediaQuery

const · packages/primitives/src/media/mediaquery.ts:43

Args{ query: string }
Model{ matches: boolean }
MessagesChanged { matches: boolean }
Its full type
const MediaQuery: Bundle.Bundle<
  'MediaQuery',
  { readonly query: string },
  { readonly matches: boolean },
  { readonly _tag: 'Changed'; readonly matches: boolean },
  never,
  never,
  never,
  void,
  {},
  {}
>

A media query as a bundle: matches in the Model, kept current by a matchMedia change stream. State stays in the parent Model, so it replays and time-travels like any other state; the browser only reports facts.

In the guides