hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
mdiin 2019-12-29T14:00:01.005600Z

Does Hoplon have an event that triggers immediately before a node enters or leaves the DOM?

mdiin 2019-12-29T14:02:17.007900Z

Why I (think) I need this: I want to animate the filtering of a list, such that nodes that are not changed by the filter are smoothly transitioned to their new positions.

mdiin 2019-12-29T14:04:06.009900Z

I found the hoplon.observer ns in brew, which adds support for mutation observers, and it does seem like a way to implement this, in combination with requestAnimationFrame. Any insights would be much welcome. 🙏

2019-12-29T18:12:05.010500Z

@mdiin afaik, mutation observers are the only way, hoplon doesn't have its own hooks

mdiin 2019-12-29T18:19:01.012800Z

Thanks, that makes sense. I was hoping there was a more idiomatic way of doing this with hoplon, though I did suspect there wasn’t.

flyboarder 2019-12-29T19:56:36.013200Z

@mdiin I would recommend the css only approach with hoplon

flyboarder 2019-12-29T20:00:36.014Z

the hoplon.observer namespace is still under active development, feel free to reach out if you need help

mdiin 2019-12-29T21:13:25.018500Z

From what I have read, what I want to do is not possible with CSS only, because I need to apply css to new nodes before they are rendered for the first time. Now that I write this, I realise that I used the wrong example before, because maybe CSS transitioning on top and left will be enough to animate the element positions.

mdiin 2019-12-29T21:13:54.019200Z

I will have to think some more on this before proceeding. Thanks.

flyboarder 2019-12-29T21:19:37.020100Z

@mdiin applying css happens in hoplon before the node is rendered, the css is applied while the element is in memory, before it’s added to the DOM