All files / app subscription.ts

0% Statements 0/4
100% Branches 0/0
0% Functions 0/3
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                             
import { Dom, Subscription } from 'foldkit'
 
import { Viewport } from '../core/domain'
import { Message } from './message'
import type { Model } from './model'
 
export const subscriptions = Subscription.make<Model, Message>()(_entry => ({
  layout: Subscription.persistentEntry(
    Dom.streamFromMediaQuery({
      query: Viewport.COMPACT_QUERY,
      mapMatches: isCompact =>
        Message.UpdatedLayout({ layout: Viewport.toLayout(isCompact) }),
    }),
  ),
  pointer: Subscription.persistentEntry(
    Dom.streamFromMediaQuery({
      query: Viewport.HOVER_QUERY,
      mapMatches: canHover =>
        Message.UpdatedPointer({ pointer: Viewport.toPointer(canHover) }),
    }),
  ),
}))