Fork me on GitHub
#re-frame
<
2018-06-14
>
curlyfry05:06:57

@nrako have any events been dispatched while the panel was open? It won't register the events when it is closed.

nrako15:06:43

I do appreciate the note. I was not on the Clojure interwebs yesterday, and have not had a chance to check yet. I guess I was surprised that app-db was rendering nil and immediately assumed it was b/c of a misconfiguration, but will start firing some events. Thanks again…

nrako18:06:28

Looks like having any event that dispatches will correctly render both the app-db and the events tab. Thanks again…

lwhorton18:06:53

is seems like it’s not necessary in re_frame for any reg-event-* to have the signature [db/cfx event].. how is that handled? i found https://github.com/Day8/re-frame/blob/17e1637f310243cab47b5900e1c4674d131db653/src/re_frame/std_interceptors.cljc#L110 which is the invoker, but i don’t get why the compiler doesn’t complain if you declare a handler with a fn signature of 1 instead of 2

mikerod19:06:21

@lwhorton that’s a cljs thing I believe

mikerod19:06:02

((fn [x] x) 1)
;;= 1

((fn [x] x) 1 2)
;;= 1

mikerod19:06:08

no warnings from a cljs repl

mikerod19:06:45

which I believe is a consequence of cljs mirroring JavaScript function calling, which allows that.

lwhorton19:06:09

ah so if it’s an unnamed fn it looks like the compiler doesn’t enforce it

lwhorton19:06:31

and somehow underneath it’s getting applied which handles the multi arity, i bet

mikerod19:06:59

You can call JS functions with too many args, and it ignores them

mikerod19:06:21

So CLJS is probably compiling to similar normal JS functions

mikerod19:06:33

(there are some other things involved, but down at the bottom)

mikerod19:06:52

I won’t say it with 100% certainty because I didn’t read the relevant impl, but I believe this is the case

mikerod19:06:48

you are correct that it looks like if I call a named defn fn in CLJS with the wrong arity, it will give a warning

mikerod19:06:02

So your link to re-frame.std-interceptors/db-handler->interceptor is a higher-order function that calls the handler - so no warnings, whether your handler is a named or anonymous fn

lwhorton19:06:09

kind of annoying… but i’m already deep in a macro so what’s one more gotchya 🙂

mikerod19:06:13

Well, it isn’t re-frame specific at least 😛 have to embrace the chaotic world of JS