Fork me on GitHub
#clojurescript
<
2020-08-26
>
Oliver George00:08:35

Am I missing other approaches? Perhaps there's a way to detect if cljs-devtools is installed.

phronmophobic00:08:56

the hijack-console! also replaces the original console. there's probably a way to detect that the current console is a clojure fn or that the console function is different from the original

lilactown00:08:47

why do you want to detect if cljs-devtools is installed before printing?

Oliver George00:08:35

thanks @smith.adriane i'll give that a try

Oliver George00:08:01

@lilactown using js/console.log with regular clojure data types produces verbose/unreadable strings

Oliver George00:08:05

Today's job is a react native app. It's not always convenient to turn cljs-devtools on (e.g. two simulators) and it's helpful to look in the simulator logs sometimes (no cljs-devtool rendering).

Oliver George00:08:53

Generally it'd be nice to log in a way which is release friendly (e.g. the pr-str wrapper) but still have the option to drill into data when debugging.

Raymond Ko16:08:43

Does anyone have experience with the cljs.analyzer and cljs.spec.alpha? I am trying to run codox on a shadow-cljs ClojureScript project, codox internally uses cljs.analyzer and my it is failing on statements whenever I use cljs.spec.alpha/assert saying it can't find:

Caused by: clojure.lang.ExceptionInfo: Unable to resolve var: *runtime-asserts* in this context at line 21 src/a.cljs {:file "src/a.cljs", :line 21, :column 3, :tag :cljs/analysis-error}

Raymond Ko17:08:08

A more general question, what does everyone use to generate API documentation for their ClojureScript projects?

Raymond Ko18:08:22

I ended up cheating and changed my cljs.spec.alpha/assert to cljs.spec.alpha/assert* even though it said not to use it.

neilyio20:08:56

I'm having a hard time defining a macro in ClojureScript. I'm following https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html from theller, and I've got it working with trival macros like:

(defmacro defstory [title & story-vecs]
  title)

neilyio20:08:11

However, when I have an error in my defmacro, it seems like the macro compilation silently fails, and I'll get an undeclared var 'defstory' error.

neilyio20:08:10

I understand that macro compilation is happening in the JVM Clojure runtime. Do I need to look somewhere else for defmacro error messages?