Search code examples
clojurescriptreagent

js/clear throws an error when called from repl


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 ?


Solution

  • 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