2

I am using reagent and am connected to the browser using weasel (tenzing template using boot). In my browser (chrome) console I am able to call clear() and it works.

However when I type (js/clear) in my cider repl, it throws an error -

ReferenceError: clear is not defined

I am however able to run (js/alert "Hello") without any problems. Any ideas what is wrong ?

murtaza52
  • 46,887
  • 28
  • 84
  • 120

2 Answers2

2

When you're typing clear() into the console you're not using the Console API, but the Command Line API.

It's not possible to call this function from javascript:

This API complements the Console API, the Command Line API is only available from within the console itself.

Note that: Some are available in both. Such as console.dir or console.clear which you can call with (.clear js/console).

ClojureMostly
  • 4,652
  • 2
  • 22
  • 24
1

Try this:

(.clear js/console)
(.log js/console "asdasd")

Worked in my Figwheel REPL. You should try Figwheel, btw: https://github.com/bhauman/lein-figwheel

In case you ask "why" but not "how", this question should clear the situation: clear javascript console in Google Chrome

Community
  • 1
  • 1
zarkone
  • 1,335
  • 10
  • 16