0

I'd like to create a stream that passes viewport size [height, width] event for a Cycle.js app using SnabDom and MostJS. It looks like installing an insert hook on the :root div to get at the vDOM.elm properties should work, but so far no joy. Also, once I get that, how would I go about exporting the events from inside the hook callback to the size$ stream?

I know there are quicker and easier ways to go about this by simply interrogating the Window object, but I'm trying to see how far I can get with pure FRP.

Tim Smith
  • 1
  • 1

1 Answers1

1

This will give you the Rect of your app container

DOM.select(':root')
.elements()
.map(x => x[0].getBoundingClientRect())

As per my knowledge, currently cycle doesn't provide access to viewport.

Imamudin Naseem
  • 1,604
  • 18
  • 21