hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
George Ciobanu 2020-06-18T04:55:56.212Z

I'm looking to build a GUI editor using hoplon but haven't found a way to do real time stuff like resizing an item when the user drags a corner. Is it possible? Efficient? If yes could someone provide a tiny snippet of how to do it? Thank you so much! P.s. should I just not use cells and use an atom instead?

George Ciobanu 2020-06-18T13:02:31.215400Z

And if I use an atom, how do I get a reference to the current element I'm calling a function from? Let's say (div :mousemove #(do something)) how do I get a handle on the div above to use it, and to update it's properties say when the user moves the cursor

2020-06-18T13:56:02.216Z

You can definitely do this in hoplon and using cells for the width would be idiomatic

George Ciobanu 2020-06-18T14:18:31.216800Z

Thank you jjttjj

flyboarder 2020-06-18T15:12:33.217500Z

@geo.ciobanu I would recommend reading through the wiki

flyboarder 2020-06-18T15:12:50.217700Z

https://github.com/hoplon/hoplon/wiki

flyboarder 2020-06-18T15:13:05.217900Z

specifically attribute providers

flyboarder 2020-06-18T15:13:19.218100Z

https://github.com/hoplon/hoplon/wiki/Attribute-Providers

George Ciobanu 2020-06-18T16:24:20.218400Z

Thank you @flyboarder

George Ciobanu 2020-06-18T19:55:25.221200Z

@flyboarder I made it work, thank you again! Any performance difference I need to be aware between atom and cell? Sometimes I only need an atom for tracking a value without needing to calculate based on it, so I'm trying to figure out which one it use. Apologies if this is a silly q!

dave 2020-06-18T19:57:23.221900Z

it seems to me like the difference is that you can't hook atoms up to cells so if you want a cell to react to your X, your X needs be a cell, not an atom

dave 2020-06-18T19:57:48.222200Z

in practice, i just use cells all the time when i'm working in a hoplon application

dave 2020-06-18T19:57:58.222500Z

you can certainly use a cell like an atom, but not vice versa

2020-06-18T20:13:53.225900Z

@geo.ciobanu cells have a built in graph mechanism allowing you to wire them together and do fancy things that way, mainly having one cell's value be automatically derived from another (and you can chain multiple together). See: https://github.com/hoplon/javelin Atoms don't come with this ability out of the box Importantly, hoplon is specifically designed to work with cells and not atoms so, of x is a cell, in hoplon you can do (div x) and the div's content will update when x changes. But the functionality doesn't work with atoms.

George Ciobanu 2020-06-18T20:23:24.226500Z

Thank you so much @dave and @jjttjj

👍 1