Fork me on GitHub
#re-frame
<
2017-12-26
>
Dos18:12:42

hi there, how crazy is the idea of wrapping a subscription with reagent/atom?

Dos19:12:57

in other words, how can I modify locally subscriptions?

curlyfry22:12:55

Could you provide a use case when you would want this? I can't think of an instance where a nested subscription hasn't solved this type of issue https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs#L39 https://github.com/Day8/re-frame/blob/master/docs/SubscriptionInfographic.md

carkh19:12:07

Is there some way to do multi-cast events with re-frame ? for instance i have this :window/resized event, that needs to do have an effect outside any view... actually resizing a phaser webgl context. I undersstand that i could add within my :window/resized reg-event-fx somethign like this : {:db newdb :phaser/resize new-size} ... but it feels sloppy, i want to separate concerns and really my window namespace shouldn't know about phaser, but rather the other way around

curlyfry22:12:43

> that needs to do have an effect outside any view. Sounds like you want to define an effect handler! https://github.com/Day8/re-frame/blob/master/docs/Effects.md#extensible-side-effects

carkh23:12:38

This is indeed what I've been doing. but I'd like to find a way to sort of reverse the order of concerns. It feels wrong that my window namespace has to know all its "callers" rather than the opposite

curlyfry23:12:59

Ah sorry, read that a bit too fast.

curlyfry23:12:45

I personally don't see the issue though, since updating the phaser context is a direct effect of resizing the window 🙂

carkh23:12:26

that window namespace is now coupled to this particular project .. what if I want to reuse it ?

carkh23:12:47

then again i might be agonizing over nothing ... at some point one needs to do project specific things

curlyfry23:12:36

I totally see where you're coming from. I haven't really seen event handlers as reusable in different projects (for some reason they seem to end up quite specific), but fx-handlers (and reagent components) end up more general and reusable.

carkh23:12:38

also I could add my own (multicast if required) event system as a new effect... and consider re-frame to only be usefull for the gui stuff

curlyfry23:12:42

(in my experience)

carkh23:12:35

i guess i'll go with that..thanks for your time !

curlyfry23:12:51

No problems! Always interesting to think about this kind of stuff

carkh19:12:42

I feel like I'm missing something obvious there

carkh19:12:00

I know I can't be doing a registration and watch it, as we're outside the reagent context (outside any view)