This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-12
Channels
- # bangalore-clj (1)
- # beginners (27)
- # boot (29)
- # clara (4)
- # cljs-dev (10)
- # cljsrn (2)
- # clojure (36)
- # clojure-austin (9)
- # clojure-brasil (4)
- # clojure-france (10)
- # clojure-nl (2)
- # clojure-quebec (1)
- # clojure-russia (10)
- # clojure-spec (48)
- # clojure-uk (6)
- # clojurescript (82)
- # clr (4)
- # core-async (5)
- # core-logic (3)
- # cursive (4)
- # datomic (1)
- # devcards (1)
- # figwheel (1)
- # leiningen (2)
- # lumo (6)
- # off-topic (23)
- # om (39)
- # onyx (3)
- # planck (2)
- # re-frame (5)
- # reagent (24)
- # specter (1)
- # test-check (3)
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
I think you're describing is figwheel's heads up display. That does sound quite handy but I suspect there are some complications.
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.
I believe think figwheels heads up display has an API. That should mean you can show any areas you catch successfully
I'm certainly not an expert in browser error handling but I did find this article interesting.
https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror.html
(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](https://github.com/clojure/clojurescript/wiki/Quick-Start#browser-repl)
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?
Clojurescript downloaded as jar from guide https://github.com/clojure/clojurescript/releases/download/r1.9.293/cljs.jar
let me check
@maksimrv this guide may be more up to date: https://clojurescript.org/guides/quick-start
(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 goog.net.xpc.CrossPageChannel.<anonymous> (crosspagechannel.js:482)
(anonymous) @ crosspagechannel.js:482
oh wow, this fixes it
--- a/index.html
+++ b/index.html
@@ -1 +1,7 @@
+<html>
+<head>
+</head>
+<body>
<script type="text/javascript" src="out/main.js"></script>
+</body>
+</html>
<body>
<script type="text/javascript" src="out/main.js"></script>
</body>
that works
<script type="text/javascript" src="out/main.js"></script>
that doesn'tI 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 https://github.com/swannodette/mies, 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 goog.net.xpc.CrossPageChannel (repl:2457)
at Function.clojure.browser.net.xpc_connection.cljs$core$IFn$_invoke$arity$0 (repl:2540)
at clojure.browser.net.xpc_connection (repl:2539)
at clojure.browser.repl.start_evaluator (repl:3043)
at repl:3052
at Object.goog.events.fireListener (repl:2229)
at goog.events.handleBrowserEvent_ (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: https://github.com/clojure/clojurescript-site/issues/51 - @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 https://content.screencast.com/users/maksimrv/folders/Jing/media/0e3eadab-1681-4efc-a1d7-52a06ed386d8/00000399.png 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 ...
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?
can you try firefox? same problem?
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
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
honestly in my experience the iframe long polling solution has been more flaky than not
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
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: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide 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
your other point is probably true - you can’t use Google Closure compatible JavaScript code that uses goog.module
(not goog.provide/require
)
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?
From memory the bootstrap modal uses a document.body class to handle the overlay styling.
If I that is the case you need to manually add/remove that class. Not quite such a pure view because of that
Here's a gist of our wrapper view.
nice, thanks @olivergeorge