This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-21
Channels
- # 100-days-of-code (6)
- # aleph (26)
- # beginners (129)
- # boot (5)
- # calva (3)
- # cider (5)
- # cljs-dev (16)
- # cljsrn (4)
- # clojure (204)
- # clojure-dev (36)
- # clojure-italy (23)
- # clojure-nl (4)
- # clojure-spec (221)
- # clojure-uk (60)
- # clojurescript (68)
- # datomic (47)
- # emacs (4)
- # figwheel-main (50)
- # fulcro (29)
- # graphql (10)
- # hyperfiddle (19)
- # lein-figwheel (3)
- # leiningen (20)
- # liberator (3)
- # off-topic (89)
- # onyx (15)
- # pedestal (1)
- # portkey (2)
- # re-frame (3)
- # reagent (6)
- # ring-swagger (1)
- # rum (12)
- # shadow-cljs (10)
- # uncomplicate (4)
- # vim (5)
Has anybody used accountant
with secretary
(in a regent
app)? I want to implement navigation and page “scrolls” for links like /some-page#my-anchor
. How can I solve this? The accountant docs are not clear about this point.
I'm using boot and can't get the repl to work at all. I tried Tenzing as well as following the modern-cljs tutorial. in both cases, boot repl --client
just hangs.
can anyone point me to the cljs-dev channel?
Doh, didn't know how to use Slack.
has anyone found strange problems with using partial
on event handlers?
so e.g on the mousedown
event we have a handler that is a partial
, where the last arg would be the e
the function being partial
ed is forward declared, too
we kept getting the error object [Mouse Event] is not ISeqable
. changing from partial
to (fn [e] ...)
fixes it
Can you paste a snippet on how you construct the partial and how do you attach it to the mousedown event?
(let [callback (partial on-mouse-down *state opts)]
(.addEventListen element "mousedown" callback true))
where on-mouse-down
is a declare
’d fn. the function right now has a simple prn
. the prn isn’t even hit
See the difference between (partial on-mouse-down ...)
and (partial #'on-mouse-down ...)
interesting. the strange thing is that this always seemed to work. maybe the order in which the code was loaded was just lucky before?
Maybe? I can definitely repro it with (defn x [] 'a) (def y (partial x)) (defn x [] 'b) (y)
I ran into my first :optimizations :advanced
issue. I get this:
Uncaught TypeError: Cannot read property 'type' of undefined
at Object.onEachFeature (titan.js:935)
And this is the offending code snippet:
:onEachFeature (fn [data layer] (let [properties-js (.-properties data)
type-js (.-type (.-geometry data))]
(if (= "Point" type-js)
(r2d2-popup layer properties-js))))
How do I begin to debug this? I assume something needs to be externed that isn't?@danie probably the .-geometry
is getting renamed. try adding (fn [^js data layer] ...)
@thheller that's now a different error:
titan.js:935 Uncaught TypeError: b.Bf is not a function
at Object.onEachFeature (titan.js:935)
try turning on externs inference https://clojurescript.org/guides/externs
@thheller Woot, thank you. I marked the r2d2-popup
function with ^js as well, that solved it all.
i’m trying to get it working at the moment
had some success in getting enzyme to render the view in a comparable way… just trying to work out how to get cljs to write the snapshots to a file for later comparison
Yep I think that was my challenge as well. Most because I would like to get a snapshot file out of a rest call
did you have any luck? currently trying to get a node repl working for running tests
no but I have to say I didn't try that hard, move to other things for now, but I could help if you have something already
thanks! i have a few ideas i’m going to try out tonight, will share what i come up with
it has some limitations, which hopefully i’ll work out fixes for, but i’ve basically got it working!
need to find a good string diffing function to display failures better, and at the moment it relies on you reevaluating your test file before running it due to the use of a macro, but it’s a start
@U06964A7P @U0C8489U6 Im not sure how much you got working on your own but here is a demo repo I setup for working with Jest and ClojureScript https://github.com/tkjone/demo-clojurescript-jest I have not tested snapshots yet, but they should be relatively easy once Jest is actually setup to work. Hope this helps!
Thanks, I’ll take a look!
I recently saw a question on ClojureVerse about CLJS frameworks. It was suggested that Reagent and Reframe are fine for ‘toy’ to medium sized apps, but that Fulcro was better for large, complex apps. Any thoughts on that? I’d almost forgotten about Untangled, and missed when it was renamed to Fulcro.
I’ll check it out.
@jmckitrick I can't speak to Fulcro but in general I find descriptions of minimalist frameworks as being for small/toy applications to be reductive. What i find the big opinionated frameworks bring to the table is a set way to organize things, which can benefit large apps/orgs by reducing the need for imposing your own organizational structure at the cost of flexibility
But minimalist frameworks can be plugged into a larger flow quite well, it just may require more initial design work
hey I'm having problems with transit On JVM:
(let [out (new ByteArrayOutputStream)
writer (transit/writer out :json)]
;; [com.cognitect/transit-clj "0.8.313"]
(transit/write writer {:foo 39225.8500M})
(.toString out))
=> "[\"^ \",\"~:foo\",\"~f39225.8500\"]"
On Browser (FF)
(let [data "[\"^ \",\"~:foo\",\"~f39225.8500\"]"]
;; [com.cognitect/transit-cljs "0.8.256"]
(t/read (t/reader :json) data))
=> {:foo #object[Transit$TaggedValue [TaggedValue: f 39225.8500]]}
There is some docs about it? transit
still a recommended way to get exchange data between clj <> cljs(browser)?
you are supposed to supply a custom handler that returns the value you want. since JS doesn't have a default BigDecimal impl
(extend-protocol IRenderData
types/TaggedValue
(render-data [v]
(cond
(types/isBigDecimal v) (.-rep v)
:else (str v)))
js/Date
(render-data [v] (a/inst->date-str v))
number
(render-data [v] (str v)))
Is it a possible/stable solution?I'm trying to use clojure.test.check.clojure-test
's defspec
macro, and it's not being picked up by my test runner
ah. probably related to https://github.com/thheller/shadow-cljs/issues/386
@lilactown yeah shadow-cljs
does not work with it. I use olical/cljs-test-runner
at the moment
How does :closure-defines
work in a repl? I know if goog-define
is used after the repl is started it doesn't work, but should it work if the repl is requiring a namespace that already has it?
@ghopper :closure-defines
works in a REPL when you use goog-define
after starting the REPL:
$ clj -m cljs.main -co '{:closure-defines {cljs.user/foo "abc"}}' -r
ClojureScript 1.10.339
cljs.user=> (goog-define foo "xyz")
#'cljs.user/foo
cljs.user=> foo
"abc"
Oh, it can be a string, but it has to have the namespace.
Great timing 😉
I got it now.
Yeah, and probably munged if needed. (TL;DR, I bet the string is essentially JavaScript at that point.)
:thumbsup:
Thanks
^ This might help in the future https://github.com/clojure/clojurescript-site/issues/268