This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-14
Channels
- # adventofcode (14)
- # announcements (3)
- # babashka (18)
- # beginners (32)
- # calva (1)
- # clj-kondo (65)
- # cljs-dev (5)
- # cljsrn (3)
- # clojure (22)
- # clojure-spec (13)
- # clojure-uk (53)
- # clojured (3)
- # clojuredesign-podcast (50)
- # clojurescript (8)
- # core-async (32)
- # cursive (15)
- # data-science (1)
- # datomic (17)
- # fulcro (48)
- # hyperfiddle (1)
- # off-topic (5)
- # shadow-cljs (2)
- # testing (2)
How many of these "special namespace"s are there and where can I find them? https://cljs.github.io/api/syntax/Math-namespace
Hi, I am using accountant library with bidi for client-side routing. In the main function, I am initializing it like this:
(accountant/configure-navigation!
{:nav-handler #(rf/dispatch [:app-state/changed-route %])
:path-exists? #(contains? #{:app/index :app/help}
(:handler (b/match-route routes/routes %)))
:reload-same-path? false})
I have several problems with it:
1. Clicking on back and forward buttons in the browser changes the URL, but does not call :app-state/changed-route event. So it is ignored by the app.
2. When I remove :reload-same-path?, each click on a link called :app-state/changed-route multiple times. But I want to allow reloading the same path to the user.
3. Sometimes :app-state/changed-route is called multiple times anyway when I reload the page.I intend to write a DRY .cljc test that uses cljs.test/async
in its :cljs
branches.
The code should run in JVM clojure as well, but the async
helper does not exist there.
Wondering if someone has tackled this problem before, maybe with some cool macro?
Something along these lines will probably do the trick
(defmacro def-async-test
{:style/indent 1}
[name & args]
(assert (symbol? name))
(let [clj? (-> &env :ns nil?)]
(if clj?
`(deftest ~name
~@args)
`(cljs.test/deftest ~name
(cljs.test/async done#
(async/go
~@args
(done#))))))))
How do people like to organize their view components in a CLJS project? One file and namespace per component? Single namespace with a file per component?
@samcferrell We do it the same as with everything else in code. In some situation, a complicated component might be placed in multiple files. In some situation, multiple simple related components placed in one namespace. As the project grows, it makes sense to start grouping components together into nested namespaces.