Fork me on GitHub

how do i clear a form input field? i'm trying (gdom/setTextContent temp-input "") but that does not work. following this tutorial:


weird, (set! (.-value temp-input) "") clears the input field if i do it in the repl, but not when i put it in a function in a file


same with (set! (. temp-input -value) ""). repl yes, file no


never mind. it was a pebkac. i was not reloading stuff correctly because i used the atom wrong


now that that works, i'm curious if this is "right" way to do it?


in pure clojurescript


If you’re managing the Dom yourself yeah that’s the way to go. Often cljs web apps are react based apps where the ui state is derived from the current state


cool. yeah, this tutorial is just on clojurescript so far, react comes soon, i think

Josef Richter08:09:24

hi folks, I was doing a quick tutorial on cljs+reagent, everything worked fine, but when I reload browser, it will just show “Shadow-cljs rocks!” now instead of the app. the app is started with shadow-cljs watch app and I tried to restart this too, but it doesn’t help. any advice, please?


sounds like a question for #shadow-cljs


just look for Shadow-cljs rocks! in your code and see what that is 😛

Josef Richter08:09:44

@U05224H0W that’s the default content of the index.html. the <app> tag content is not being replaced by (cl)js for some reason..


what does the browser console say?

Josef Richter08:09:25

breaking_bad_quotes.core.init is not a function

Josef Richter08:09:40

<script>breaking_bad_quotes.core.init();</script> this one fails basically


just that or also a 404 on the .js file or so?


did you maybe change the namespace in your code?

Josef Richter08:09:26

the main.js returns 200, seems ok. no 404 anywhere


and the watch compiled fine?

Josef Richter08:09:14

namespace not changed. the weird thing is it worked, but it broke down on browser refresh. watch seems to be working fine, no compilation errors.


any error in the browser console BEFORE "is not a function"


must be something happening that breaks the loading of the code. assuming that the names are otherwise all correct.


hmm that looks like you are maybe calling the function too early?


is the script tag loading the JS coming after the actual call?


btw the call should probably be removed entirely and use :init-fn in your config instead

Josef Richter08:09:12

yes, it’s right underneath it.. but I didn’t really touch anything there. it’s mostly code generated by lein new shadow-cljs breaking-bad-quotes +reagent


I do not know what you did or didn't do. if you share the code I can probably tell you whats wrong. otherwise I'm just guessing which isn't very useful it seems.

Josef Richter08:09:59

ok gimme a sec

Josef Richter09:09:22

this is the code, I’ve been making changes only in core.cljs and adding deps in shadow-cljs.edn


well .. there is no init fn?

Josef Richter09:09:53

oh I’m a fucking idiot

Josef Richter09:09:07

I was following the tutorial too literally and accidentally remove it

Josef Richter09:09:23

and was stupid enough not to realize that the init() that I’m calling is not there

Josef Richter09:09:50

@U05224H0W sorry for wasting your time, thank you for your help though!


Does the Closure compiler have a way to handle Longs? This library seems to suggest so But i am not that familiar with Closure Compiler


The Closure library has this type: goog.math.Long


It is used by some libraries in the ecosystem, like transit

👍 3