Fork me on GitHub
#keechma
<
2019-06-03
>
carkh14:06:36

@mihaelkonjevic using defelement for css from toolbox, and looking at your github project devtools, I see that you use some of these elements by passing additional parameters like this : [-event-batch-label "BATCH #" batch-num] but i don't understand what the defined element is doing with those parameters.

mihaelkonjevic14:06:02

@carkh defelement creates a reagent keyword with assigned classes, and registers the css in the css atom. It’s a bit more involved to get it running, but you can check here: https://github.com/retro/protok-frontend/blob/master/src/protok/core.cljs#L30 https://github.com/retro/protok-frontend/blob/master/src/protok/styles.cljs . So you can use defelement var as you would use any other reagent tag - it will look something like this: :div.added-classes.var_namespace--var-name

carkh14:06:32

oh silly me, that's the content of the tag

carkh14:06:53

thanks ! also i went ahead and started the real thing, which is a chrome extension. in an extension the pages communicate with a background page via a special websocket like api... i have the thing working outside of keechma, but i need to integrate this with dataloader. So the design would be to create a controller to maintain the communication channel and the datasources loader functions would access the controller's channel... Sounds about right ?

mihaelkonjevic14:06:53

yes, but it will require some trickery. So in your loader fn, you have access to the app-db. Running controller instances are stored in the app db [:internal :running-controllers :controller-key] so you get the controller from there and then send the messages to it.

carkh14:06:11

ok exactly what i expected

mihaelkonjevic14:06:22

also, you’ll probably need to do some orchestration between channels and promises, but that shouldn’t be to hard

carkh14:06:06

no problem with that.... i like the css stuff you have goign on there, no magic at all and good for instant feeback

mihaelkonjevic14:06:27

yeah, it’s pretty simple, but it works. You can also use https://github.com/retro/garden-basscss for some good base classes

carkh14:06:13

i do, due to copy pasting your projects =)