You could also use Zelkova (an elm-style frp library): https://github.com/jamesmacaulay/zelkova <https://github.com/jamesmacaulay/zelkova>
> On Dec 10, 2015, at 3:41 PM, Erik Price <[email protected]> wrote: > > You can use a channel to capture this. Keep in mind that channels have > different semantics from signals, so you'll write different code, but it can > be done. > > You can also use RxJS. Leonardo Borges has a CLJS wrapper for it: > https://github.com/leonardoborges/rx-cljs > <https://github.com/leonardoborges/rx-cljs> > > e > > On Thu, Dec 10, 2015 at 3:24 PM, Adam Kowalski <[email protected] > <mailto:[email protected]>> wrote: > I would like to have a way to represent the current width and height of the > window but I am not quite sure how to go about doing this. For example if I > have some element on the screen and I want it to be 50% of the window width, > I would need to know every time the window is resized and update the width of > my element with the new information. > > In a language like Elm there was a Signal abstraction, which represented > values which change over time. These signals could then be made to dispatch > an action when they change. For example when window dimension signal had a > new value, it would dispatch an action that would be picked up by my update > function and would return a new model correctly representing the current > state. > > In ClojureScript it seems like core.async is a good way to model something > like this but I am not sure if this is the correct approach. I would create > a channel (ie: window dimension, mouse position, etc), and would then have an > event listener for (resize, or mouse move) that would place the current > values onto the channel. Then I would need something to grab that value of > the channel and mutate my model. > > Am I on the right track, or can I do something different/better? > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:clojurescript%[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/clojurescript > <http://groups.google.com/group/clojurescript>. > > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/clojurescript > <http://groups.google.com/group/clojurescript>. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
signature.asc
Description: Message signed with OpenPGP using GPGMail
