Fork me on GitHub
#re-frame
<
2016-07-05
>
macroz10:07:54

@mikethompson your writing on the effectful handlers came to my mind while reading about https://github.com/yoshuawuyts/choo

macroz11:07:16

kind of still wishing that the app-db would be easily parametrizable

macroz11:07:42

i.e. no globals

macroz11:07:16

in practice it hasn't been a problem outside of devcards / testing concerns

nilrecurring12:07:53

@javazquez @mccraigmccraig I just discovered that I need debouncing too in the project I'm working on. How are you doing it?

mikethompson12:07:50

@macroz: It would be easily enough to eliminate globals and turn re-frame from a framework into a library. Yah!!! But I've just never had the need. I';m aware that it is an issue with devcards, but I've never used them, so I admit to being a bit lazy in this regard. Other things have seemed more interesting (I'm very excited about v0.8.0).

macroz12:07:36

yeah I totally understand

macroz12:07:51

only recently got interested in the devcards style development style

macroz12:07:15

I find it so productive creating new components in a separate page where I can just install the component in every state imaginable and see that it looks correct

macroz12:07:37

only can't make it interact because of the global limitation

macroz12:07:41

don't want to go to iframes yet 🙂

macroz12:07:22

I use similar style in React app, call it the component guide (vs. style guide vs. devcards)

mikethompson12:07:41

I will get there. But it will be v0.9.0

macroz12:07:55

thanks for all the hard work anyway 🙂

macroz12:07:43

found your article about the effects and choo interesting because I have a bunch of websocket stuff

mikethompson12:07:14

Well all the cool kids are into BOTH effects and coeffects these days.

mikethompson12:07:54

So naturally, I'll be adjusting my doc very shortly to talk about both 🙂

mccraigmccraig15:07:34

@javazquez: on a previous project (which used core.async) i used this implementation (with macros & cljs) https://www.refheap.com/9185570a58a7cdcb31a7851a7 https://www.refheap.com/0ba212261580d881fa5ccf100

mccraigmccraig15:07:29

the crux of it is in the cljs (second) paste - if an operation is already in progress it effectively drops it, and only ever returns a result from the last invocation of the operation - prior invocations return the nil of a closed channel

javazquez19:07:24

I don't quite understand how this line of code works.. https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/views.cljs#L83 :on-save #(dispatch [:add-todo %])}]] how is an argument being passed for "%"?

dfcarpenter20:07:37

I think the # in front of dispatch is equivalent to

(fn [e] (dispatch [:add-todo e]))

rohit20:07:25

@javazquez, @dfcarpenter: correct. #(..) is for anonymous function literal. more here: http://clojure.org/reference/reader#_dispatch

javazquez21:07:52

@rohit: @dfcarpenter understood... but how is the parameter passed? The handler gets a "text" passed.. https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/handlers.cljs#L75

rohit21:07:53

@javazquez: that responsibility is in todo-input.

dfcarpenter21:07:13

@javazquez: It’s because that is the name you are giving the value of the input. When you enter text into the input field and press enter it’s sending a text value. This text value is dispatched to the handler and you are naming the argument “text” merely for convenience to remind you what it is.

javazquez21:07:06

thanks, that makes sense... this seems to contradict my previous question of using an atom https://clojurians.slack.com/archives/re-frame/p1467582951001031

javazquez21:07:58

I am ok with the approach.. just want to make sure I am doing it in the way the frame work meant me to 🙂

dfcarpenter21:07:51

All re-frame is providing you with is a central data store and the transport mechanisms to get data into it.