This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
that is delightful!
arohner: did you get it to work? my website http://sanderdijkhuis.nl/ is built with om and prerendered server-side. i use om.dom/render-to-str
i’m trying to use cljs.js/eval
. is there anything special I need to do to before running it? i tried evaling a simple form like (def hello “hi”)
and it successfully generated cljs.user.hello = “hi”
, but failed to run it because cljs.user
is undefined.
@sekao: I just evaled "(ns cljs.user)", it seems to work
@ericnormand: thanks that does indeed work
@ericnormand: what i am trying to do is a bit more complicated, though. i’m reading a file form-by-form and evaling each one individually. this seems to break because cljs.js/eval
wants me to supply a namespace, rather than remembering the one that was created the last time I ran it. I assumed the state atom would store that or something.
it looks like i need to manage that myself. i’m reading the planck source code and it appears to keep track of the current-ns itself, so i’ll try to do something like that.
@sekao: state atom isn’t going to track the current ns, would create more complications than it solves
you need to track it yourself, all serious JS I/O is async so putting this info into the state atom would be very problematic
@arohner did you have any success with server rending?
rendering*
I’ll take a look back at that old repo and see if I can get it to work with updated react versions
anyone here using Quiescent? If so, are you doing animations with it via the CSSTransitionGroup component?
@sekao: ok, I see. that is more complicated than my solution can fix
@sekao: I haven't had to do anything more than work in cljs.user
so far
@pleasetrythisathome: no, I didn’t get it to work
oh, looks like my problem yesterday was caused by using drip
what is the best reliable way to speed up jvm start times so lein and such run faster (without breaking a number of things like drip did)?
@paradoxquine: run a cpu based profiler pointing at lein and figure out the reason it's slow and send pull requests
HINT: it's not the jvm boot being slow (at least, likely not), the jvm boots in like 100ms on my machine, more loading clojure + your deps + your app's code being slow
@paradoxquine: in the meantime: https://github.com/technomancy/leiningen/wiki/Faster
@tcrayford: profiling that is a bit over my head at the moment but i’ll see what I can do weird that it’d be my project or deps since my project was just 10 lines of vanilla clojure until just recently
@paradoxquine: probably just loading clojure.core then, I'd guess.
with larger projects/apps, getting a repl running and your code loaded typically goes up well past say, 30s, maybe a minute or two
@paradoxquine: that's all for clojure. I'm gonna guess them thar things are very different in cljs land, but if you're running lein you still have the same problems somewhat
that is…worrisome. or maybe i’m just used to radically different ecosystems and it won’t matter
I have a function which makes a Google map, then puts a marker on it, then does a .nearbySearch
and does a loop-recur
through the results to make a bunch of markers and put them on the map. This loop-recur
works great when I'm using lein figwheel
, but not after in a JAR after lein uberjar
. I get the results back, but no markers get made. This puzzles me. I have the Google Maps externs file. Does anyone have any guesses as to why this isn't working?
@coyotespike: can you post a gist with both the config and the loop-recur
code?
@bensu: sure thing, here's a gist with the code (kind of fun because it's async and stuff anyway).
I thought the info-windows' callback function might be causing a closure problem, but after removing the info-windows, the markers still don't work in an uberjar
.
Like, I thought this might be related, but now it doesn't seem so: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures#Creating_closures_in_loops_A_common_mistake
@coyotespike: I'm assuming the code that goings into the uberjar has been compiled with :advanced
Yep, that's right
Since the code outside of the loop-recur
works, I'm figuring that must the culprit...
@bensu Both good ideas, let me try the first/rest thing
for the other part, gobj
is reccommended, look at this commit https://github.com/omcljs/om/commit/bac9908e4a8123c3b0e58715c1329b3b48ab01b6
hmm...I'm using Reagent, does that make a difference?
Ah, gotcha
@bensu: Wow, good recommendation - I put (js/console.log lat lon)
in the loop-recur
and got undefined undefined
.
So it's not accessing those deeply nested properties after compilation
i’m trying to bootstrap a very basic om application and I keep getting no target specified. running document getElementById in the fighweel repl also says that it can’t be found, but in the chrome console it finds the element without issue. how can I go about debugging such a case?
@coyotespike: cool, then replace those property access by gobj
as in the om commit
@paradoxquine: can you show the code where you mount om (om/root my-component app-state {:target ...})
?
Open question to cljs users. Anybody that has an package.json
at their top level dir and interacts with npm
routinely?
I'm working on a cljs.test
runner for karma, and I'm deciding how much of the npm
config I can/should hide from the user
Trying to clarify high-level thoughts about the future of Planck. Feel free to comment here: https://gist.github.com/mfikes/c7da1e7dfded26c7ceb9
@bensu: no luck, same error
and yep, i do have a dom node with that id. for silly project reasons, it’s inside a template that is asynchronously rendered by angular, but the error happens even when i reload the code via figwheel, to it looks like it’s trying to bootstrap again, and the element is definitely on the page at the time it tries again
changed to
{:target (do
(. js/console (log "ran this code"))
(.getElementById js/document "om-test"))}
and it logged successfully each reload
lolwut. it logs the element exactly as expected
i’m going to try something…om-tools is giving me weird warnings about macro redefinition or something way over my head. going to try without using it at all
@paradoxquine: don't know what lolwut means
about the angular template. Remember that when you call om/root
it establishes an async rendering loop of its own. I don't know how would that interact with the template
ah sorry, internet colloquialisms. not using om-tools didn’t help. i’ll try running in a page with literally nothing but the om-test id’d element and see
@bensu: sorry to be thick, but I'm a little puzzled about get-prop
usage.
darn, no luck there either. same error. i must be doing something really dumb
(get-props "G" result)
, (get-props .-geometry.location result)
yield an error, (.-prop result)
yields undefined.
though now i’m getting the error invalid arity: 1 sometimes instead
@paradoxquine: this line is the source of the invalid arity error: https://gist.github.com/nicolasartman/4166ddc4b8b7f3f07496#file-core-cljs-L20
thank you @jackjames, will fix that immediately now that i know
@coyotespike: don't use get-props
, read https://closure-library.googlecode.com/git-history/docs/namespace_goog_object.html getValueByKeys
and access the js properties using that function
@paradoxquine: you need something like this there: https://www.refheap.com/108012
@bensu: ah, enlightenment dawns
huh, so it’s entirely the way i was making the function? time to read more beginner docs I guess
@paradoxquine: #([:h1 "a"])
tries to call the vector [:h1 a]
as the function. That error is probably unrelated to the :target
not found
@bensu - damn, that totally worked!
Thanks for your help, that would've taken forever to figure out. I can see I need to do some reading on why using getValueByKeys
is necessary in the first place
oh, i see. read up on that and makes more sense. thanks for your help @jackjames and @bensu. that actually fixed the strange target error too
@coyotespike: @paradoxquine I'm glad