rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
2017-08-31T08:28:03.000119Z

@pez yes mixins are a way to go

2017-08-31T08:28:22.000097Z

do it in :will-mount or :did-mount, clean up in :will-unmount

2017-08-31T08:28:29.000097Z

that way it’ll be only installed once per component deploy

2017-08-31T08:28:55.000102Z

usually it’s a good idea to tie these thing to component lifecycle anyways

2017-08-31T08:29:12.000402Z

memoize to make sure fn only fires once is a terrible idea :)

pez 2017-08-31T08:36:36.000156Z

@tonsky: Thanks. I do not like that idea myself. 🙂 I did solve it using a mixin at first, but then ran into problems for the conditional guarding the install. There is state in an atom that I need to check in deciding if the listener should be installed or not. I couldn’t figure out how to feed that decision into the mixin, And trying to deref the atom threw errors. Is there a particular part of the README I should look at?

2017-08-31T08:44:31.000161Z

mixins get state passed in

2017-08-31T08:44:48.000291Z

if you get (:rum/args state) you’ll get component arguments vector

pez 2017-08-31T08:45:31.000155Z

Wonderful! Thanks!

2017-08-31T08:45:39.000136Z

from there, you have exactly the same stuff as inside render method