So I have cljs-devtools and Dirac set up and am enjoying REPLing in Dirac instead of Figwheel REPL. But how does one see Cljs code like in Nolen’s https://youtu.be/mty0RwkPmE8?t=24m39s ?
In my Sources
Dirac tab, I only see JS sources?
@fasiha can you confirm that it works in normal (internal) devtools?
@darwin I've never seen cljs code in Chrome Devtools (even before I installed Dirac/cljs-devtools), is it just supposed to be there under Sources…? (I feel really silly, I'm sure it's something very stupid I'm doing)
Figwheel puts compiled code in resources/public/js/compiled, and I have a Clojure webserver serving out resources/public as the web root, so all I see in Sources is compiled JS code
Doh, actually, if I drill down under Sources, I see cljs files, e.g., out/cljs/core.cljs, and they're syntax-highlighted
And I see my app’s cljs source code too 😄
A question for cljs-devtools
...I see a different output between:
(.info js/console "Calling back!" {:data "a lot of data"}) ;; formatting here is done
and:
(set! cljs.core/*print-fn*
(fn [& args]
(apply (.-info js/console) args))) ;; no formatting
Shouldn't I see the same?@richiardiandrea *print-fn*
receives strings from cljs printing subsystem, not original objects. https://github.com/binaryage/cljs-devtools/issues/5#issuecomment-132212643, btw. you should use the enable-console-print!
implementation, yours is not 100% correct, because you are calling js/console.info without passing js/console as “this” object
@richiardiandrea you'd address the this
issue by doing:
(apply (js/console.info.bind js/console) args)
But, of course, the other issues raised by darwin would need to be addressed first, so this is really only background info.
@darwin ok, I copied it from the cljs source 😄 I am trying to improve the debug printing in replumb
a bit and make it compatible with cljs-devtools
, I will follow your and Mike's guidance and report back 😄
btw I had exactly the same implementation in core.cljs
but I thought it was wrong and did not quite read through it...so I guess I will roll my own