Fork me on GitHub

you know how that when I get a cljs compile error, the webpage displays it at the bottom in a div taht slides up? is there a way to force assertions into that window too? so now when I get an assertion, instead of it going to the console, I want it to also go into that div where the compile errors normaly appear

Oliver George04:02:44

I think you're describing is figwheel's heads up display. That does sound quite handy but I suspect there are some complications.

Oliver George04:02:58

The types of errors you are describe are runtime errors. To my knowledge it's a bit tricky to catch top level errors reliably. Doubly so when there is something like react's dispatch loop controlling flow and catching errors itself.

Oliver George04:02:02

I believe think figwheels heads up display has an API. That should mean you can show any areas you catch successfully

Oliver George04:02:29

I'm certainly not an expert in browser error handling but I did find this article interesting.

Oliver George04:02:34

(At the time I wanted the errors thrown by spec to be presented better.)


Hello, I have trouble with setting up browser repl from [Quick Start]( All steps before work as expected. When I run rlwrap java -cp cljs.jar:src clojure.main repl.clj I see a message in the terminal: Compiling client js ... Waiting for browser to connect ... After that, I go to http://localhost:9000 in Chrome. In terminal I see: WARNING: Use of undeclared Var clojure.browser.repl/repl-print at line 144 WARNING: Use of undeclared Var clojure.browser.repl/repl-print at line 145 WARNING: Use of undeclared Var clojure.browser.repl/print-queue at line 147 WARNING: Use of undeclared Var clojure.browser.repl/flush-print-queue! at line 148 WARNING: Use of undeclared Var clojure.browser.repl/xpc-connection at line 148 And that is all, no prompt appear in the terminal. If open developer tools there are no errors, and also I see that was created iframe with url 'http://localhost:9000/repl?xpc=%7B%22cn%22%3A%225hwaMJvPgJ%22%2C%22tp%22%3Anull%2C%22osh%22%3Anull%2C%22ppu%22%3A%22http%3A%2F%2Flocalhost%3A9000%2Frobots.txt%22%2C%22lpu%22%3A%22http%3A%2F%2Flocalhost%3A9000%2Frobots.txt%22%7D' So I have spent a coupl of hours to undestand what's wrong but no success. Thanks OS: macos, Terminal: iTerm Java: java version "1.8.0_72"


Clojure version?


Cljs version?


So as I understand it contains clojure (inside jar clojure version 1.8.0)


let me check


(not sure if there are any differences)


hitting some problems with the Quick Start guide as well


When the repl is supposed to connect, I get

Uncaught TypeError: Cannot read property 'appendChild' of null
    at<anonymous> (crosspagechannel.js:482)
(anonymous) @ crosspagechannel.js:482


oh wow, this fixes it


--- a/index.html
+++ b/index.html
@@ -1 +1,7 @@
 <script type="text/javascript" src="out/main.js"></script>


<script type="text/javascript" src="out/main.js"></script>


<script type="text/javascript" src="out/main.js"></script>
that doesn't


I thought that browsers always added body and head if it was missing in an html file but apparently not


@maksimrv looking at your specific error, I think the warnings you mentioned can be safely ignored


I was able to get it to work with, which is similar to Quick Start (there's a section on how to create a browser repl)


No matter which browser, if I open index.html from the Quick Start REPL section using a file:// url, I get

Uncaught Error: URI file:/robots.txt is invalid for field ppu
    at new (repl:2457)
    at$core$IFn$_invoke$arity$0 (repl:2540)
    at (repl:2539)
    at clojure.browser.repl.start_evaluator (repl:3043)
    at repl:3052
    at (repl:2229)
    at (repl:2232)
    at repl:2221


It works if I start an ad-hoc web server to serve index.html on any port.


That seems like an issue with the Quick Start guide to me.


Hey brothers how can I create a action in form to go router ? I'm using secretary, I'm using e.preventDefault but I didn't find how to use to "go url" I puted in my button with type "submit", if I use with :href "/route" it's working ;/


I've created an issue at the clojurescript-site repo: - @dnolen, let me know if there's a better place to report issues with the guides


@dnolen via trial and error I discovered the possibility to use goog.modules as dependency. If the argument {'module': 'goog'} is added to the dependency entry in cljs_deps.js, the module is loaded and the namespace available. But currently it seems not supported via compiler options. Are there any plans to add the support?


@pesterhazy thanks, I have installed mies but have the same problem Am I right that repl should start in the terminal where we run './scripts/brepl'?


I have used server which is started with repl on 9000 port but If I run simple python server (python2.7 -m SimpleHTTPServer 8080 ) and go to localhost:8080 the problem is same ...


Also, I have checked zsh, bash and other shells .. same effect


it starts once you open a browser window showing index.html


so the process is first scripts/brepl then open the browser at the location


@pesterhazy my steps 1. Run build (in Terminal) 2. Run repl (in Terminal) 3. Go to page localhost:9000/index.html (in Chrome) 4. Where should I type (+ 1 1)?


do you see "hello world" printer in the chrome console?


Nice, but in my case I don't see prompt cljs.user=>


I see "hello world" in developer tools


can you try firefox? same problem?


and see that frame which connected to repl created


but prompt string don't appear


But ok I try to experiment with Ubuntu, as I see the problem in infrastructure like terminal, os etc. Thanks!


don't see how an infrastructure problem could be at fault here


@maksimrv is the prompt buffered? if you slam enter a few times, does it show up?


> if you slam enter a few times, does it show up? No


one possibility is browser caching issues.. that's why I suggested trying another browser


or even restarting the computer may help 🙂


@pesterhazy wow you are rigth


I have tested on WebKit based browsers


but now open Firefox and all work


honestly in my experience the iframe long polling solution has been more flaky than not


you can disable caching in devtools btw


@maksimrv FWIW if you are a new user, $ lein new figwheel yourappname is the way to go


websocket based repls are more stable (weasel, figwheel)


@pat, it's good to go through the Quick Start


@pat I have disabled cache start in incognito open another webkit browser it does not work


but in Firefox ...


Quick Start helps you understand how things hang together


sure, but spending hours debugging builds is a huge turnoff to cljs in general. skip it, start hacking 🙂


agree, but at some point it's a good idea to do the Quick Start too


also we should help Quick Start become more reliable


Thank you @pesterhazy and @pat now I could complete Quick Start guide)


@danielgrosse I just don’t understand what you are suggesting. If it’s not normally possible in Google Closure we’re not going to bother hacking to make it possible


@dnolen As I read here: Closure offers an ES6 like module system. And as ClojureScript now supports these modules as output, I thought this would also work as input. Like

:foreign-libs [{:file "resources/libs/calculator.js"
                :provides ["calculator"]
                :module-type :commonjs}]
Currently, closure libraries which use goog.provide() are detected and used within CLJS. But goog.module() isn't.


@danielgrosse it seems to me that your mixing up several things here


the JS module stuff doesn’t have anything to do with goog.module


so let’s set that aside


your other point is probably true - you can’t use Google Closure compatible JavaScript code that uses goog.module (not goog.provide/require)


so file an issue for that with a minimal example


Okay, thank you for the answer. I will create an example for the issue.


hi, is there a way to make this snippet accept the bootstrap's class "modal"? It works if I add :id on modal div, and :data-target, :data-toggle attributes on the button, but then atom modal? does work in the case use the the modal is closed by clicking on overlay div?

Oliver George22:02:05

From memory the bootstrap modal uses a document.body class to handle the overlay styling.

Oliver George22:02:46

If I that is the case you need to manually add/remove that class. Not quite such a pure view because of that

Oliver George22:02:54

Here's a gist of our wrapper view.