valerauko 2020-06-12T09:42:01.374900Z

@mikethompson how do i "just mainline it"?


Kinda like that .... hmm, not the best example


Give me a minute ... I'll quickly get a better example


Imagine you wanted to capture all windows resize events ... always ... you'd like hook that event, maybe in core.clj like this ...

(.addEventListener js/window "resize" (fn [event] (dispatch[:resize xxx])))


You would quite literally put that code in core.cljs outside of any functions and then, when you code was loading, you'd hook the event outside of any event handlers


Why? Because you only need to do it once


And then keep the hook in place through the entire life of the program


I'd imagine your scenario would be the same.


You want to set up an on-message callback which will do a`dispatch` (much like my resize example above)


And that on-message callback needs to be setup as the program boots, and is never removed


That's what i meant by mainline it. Just cause the event to be hooked turning code loading. Don't particularly worry about causing it to happen in effects, because it is not something you need to turn "on" and then "off"


@ ^^^

p-himik 2020-06-12T09:57:17.377800Z

Decided to check out the meaning of the verb "mainline":

transitive verb; slang: to take by or as if by injecting into a principal vein
intransitive verb; slang: to mainline a narcotic drug
Kinda funny given that such a global statement can be considered "dirty" in some sense.




It is slang which carries connotations of a fast, crude but effective way of making something happen. Effective in a brute force way, not an elegant way. And yes, it is a term from the 60s and 70s regarding heroin injection. You sometimes hear people talking about mainlining a Netflix season (binge watching).

valerauko 2020-06-12T12:10:08.378400Z

yes that is exactly what i was looking for! i wasn't sure what was the "ideal" place to put that (.addEventListener ,,,) . thanks for the detailed guidance! ❤️

valerauko 2020-06-12T14:24:52.378900Z

is there some recommended way to deal with css in re-frame/shadow?


Herb is a layer above garden so you can benefit both


there is also a #css channel

p-himik 2020-06-12T14:26:39.379Z

As far as I'm aware, re-frame and shadow-cljs don't have anything special for CSS and don't affect your preferred workflow in any way. So you can use whatever you'd use without them.

valerauko 2020-06-12T14:29:15.379200Z

this is my first foray into this kind of frontend development so i don't know what i can use with this setup in the first place

p-himik 2020-06-12T14:35:26.379400Z

In this case, #clojurescript might be a more appropriate place to ask - it has 10 times more people than here.

valerauko 2020-06-12T14:36:56.379600Z

ok i'll do that, thanks


i use roosta/herb and found it really interesting


very simple and powerful

valerauko 2020-06-12T14:40:09.380300Z

that looks exciting, gonna check it out! thanks!


you also have which was announced recntly on #reagent channel

valerauko 2020-06-12T14:42:58.381Z

i'll try both and see which works better with what i'm trying to do


roosta/herb is really nice since it use simple functions