I'm trying to get to grips with reagent in clojurescript with a simple drawing program.
I'm looking for an example of how to access the mouse position in a principled "FRP" inspired style with Reagi.
In various reagent examples I can see things that look like this :
[:p [:onmousemove (fn (evt) ...)]]
to attach a handler to an element of the DOM.
And to make a Reagi "behaviour" I want to write something like this :
(def mouse-positions (r/behavior ( ... )))
But how do I combine these two so that a handler I add to a DOM element feeds a Reagi behavior?
Secondly, as I'm using reagent, I'm expecting these DOM nodes to be recreated regularly. Presumably I'll need to keep rebinding the event-handler to the Reagi stream too. How do I ensure this?
cheers