how do i clear a form input field? i'm trying (gdom/setTextContent temp-input "")
but that does not work. following this tutorial: https://www.learn-clojurescript.com/section-2/lesson-15-capstone-temperature-converter/
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
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?
this is the tutorial I was following https://www.rockyourcode.com/tutorial-clojurescript-app-with-reagent-for-beginners-part-1/
sounds like a question for #shadow-cljs
just look for Shadow-cljs rocks!
in your code and see what that is 😛
@thheller 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?
breaking_bad_quotes.core.init is not a function
<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?
the main.js returns 200, seems ok. no 404 anywhere
and the watch
compiled fine?
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.
no other errors in console. see screenshot https://www.dropbox.com/s/lcw9cy1n6appskp/Screenshot%202020-09-09%20at%2010.51.46.png?dl=0
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
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
it’s this brief example https://www.rockyourcode.com/tutorial-clojurescript-app-with-reagent-for-beginners-part-1/
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.
ok gimme a sec
this is the code, I’ve been making changes only in core.cljs
and adding deps in shadow-cljs.edn
https://github.com/josefrichter/breaking_bad_quotes_test/blob/master/src/breaking_bad_quotes/core.cljs
well .. there is no init
fn?
oh I’m a fucking idiot
I was following the tutorial too literally and accidentally remove it
and was stupid enough not to realize that the init() that I’m calling is not there
@thheller 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 https://www.npmjs.com/package/long. 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