Get the document body dimensions in a flyd stream every time the user resizes the window.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Generate a flyd stream for document size, in streams of pairs of [document.body.offsetWidth, document.body.offsetHeight]. Each pair is pushed to the stream whenever the user resizes their window.

import windowStream from 'flyd-windowresize'

windowStream() // [100, 200]
// user resizes window...
windowStream() // [400, 500]

halfSize$ =
  (pair) => [pair[0] / 2, pair[1] / 2]
, windowStream )