re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
valerauko 2020-06-12T09:42:01.374900Z

@mikethompson how do i "just mainline it"?

2020-06-12T09:43:42.375400Z

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

2020-06-12T09:45:14.375600Z

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

2020-06-12T09:48:17.375800Z

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])))

2020-06-12T09:49:25.376Z

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

2020-06-12T09:49:36.376200Z

Why? Because you only need to do it once

2020-06-12T09:50:12.376400Z

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

2020-06-12T09:50:23.376600Z

I'd imagine your scenario would be the same.

2020-06-12T09:51:06.376800Z

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

2020-06-12T09:51:28.377Z

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

2020-06-12T09:53:46.377400Z

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"

1👍
2020-06-12T09:54:11.377600Z

@https://app.slack.com/team/UAEH11THP ^^^

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.

2020-06-12T10:26:50.378Z

:-)

2020-06-12T10:37:01.378200Z

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?

2020-06-13T07:35:14.383Z

Herb is a layer above garden so you can benefit both

1👍
2020-06-19T04:19:02.454Z

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

2020-06-12T14:39:21.379800Z

i use roosta/herb and found it really interesting

2020-06-12T14:39:37.380Z

very simple and powerful

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

that looks exciting, gonna check it out! thanks!

2020-06-12T14:41:06.380500Z

you also have https://github.com/khmelevskii/emotion-cljs which was announced recntly on #reagent channel

1👍1💯
valerauko 2020-06-12T14:42:58.381Z

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

2020-06-12T15:08:30.381200Z

roosta/herb is really nice since it use simple functions