Fork me on GitHub
#clojurescript
<
2022-10-16
>
thheller09:10:05

look up externs inference in CLJS. it tells the compiler that the returned object is a JS object that'll require externs to be generated, which prevent renaming by :advanced optimizations

thanks3 1
phill17:10:16

How to use re-frame-10x? I followed along with https://github.com/day8/re-frame-template using the +10x option and, browsing localhost:8280, I see the "hello from re-frame" message, so I know that the app-db is {:name "re-frame"} and that the initialize-db event fired. But, in the 10x panel at right, I do not see any events, even though the template used fn-traced for initialize-db. @hen I add a [:name] path inspector it comes up nil instead of showing the value the web page got from the subscription. The subs tab says "There are no subscriptions to show."

johnnyillinois20:10:40

Noobie question. Is it possible to redefine a cljs function in another namespace? E.g.

(:require [com.something :as something])

(set! something/hello (fn [] (println "new hello!"))
Will other callers pick up this new definition? If they have already loading the original definition?

dvingo23:10:39

that will work for single-arity functions, if you have multi-arities or varargs the compiler emits multiple js functions

dvingo23:10:57

i just implemented this for malli instrumentation if you want to see how to go about it

dvingo23:10:14

you can view the compiled js code in this tool

dvingo23:10:38

try pasting in some functions to see:

(defn hello [] (println "hi"))

(defn hi [& args] (println "args" args))

johnnyillinois21:10:34

Taking a 👀 thanks!

johnnyillinois03:10:50

Yeah this is multi-arity in this case

johnnyillinois03:10:13

Probably best to avoid patching & just fork if need be