This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-10
Channels
- # announcements (1)
- # babashka (44)
- # beginners (188)
- # calva (37)
- # chlorine-clover (28)
- # cider (12)
- # clj-kondo (40)
- # clojars (1)
- # clojure (323)
- # clojure-austin (7)
- # clojure-europe (20)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-spec (7)
- # clojure-uk (37)
- # clojuredesign-podcast (1)
- # clojurescript (30)
- # cryogen (2)
- # cursive (30)
- # data-science (1)
- # datomic (26)
- # emacs (1)
- # events (1)
- # figwheel-main (13)
- # fulcro (89)
- # garden (1)
- # graalvm (20)
- # graphql (8)
- # jobs (1)
- # jobs-discuss (1)
- # joker (6)
- # kaocha (125)
- # lambdaisland (1)
- # meander (42)
- # off-topic (18)
- # pathom (3)
- # pedestal (6)
- # shadow-cljs (55)
- # spacemacs (21)
- # sql (18)
- # tools-deps (8)
- # uncomplicate (2)
- # vim (1)
- # yada (3)
All three of the following two work:
(.log js/console "console1")
((. js/console -log) "console2")
((.-log js/console) "console3")
But only the first of the following works:
(.requestFullscreen element)
((. element -requestFullscreen))
((.-requestFullscreen element))
Does anybody know what I can change to make it work?
I need to pick out an existing function from the element and then use it, and thought I'd do the following. But doesn't seem to work.
request-fullscreen ((some-fn .-requestFullscreen
`.-mozRequestFullScreen`
`.-webkitRequestFullScreen`
`.-msRequestFullscreen)`
`element)`
...
(request-fullscreen)
(let [el (.querySelector js/document "#app")
fun (cond
(js-in "mozRequestFullScreen" el) el.msRequestFullScreen
(js-in "msRequestFullScreen" el) el.mozRequestFullScreen
(js-in "requestFullscreen" el) el.requestFullscreen)]
(fun))
Hi, I'm currently running shadow-cljs but am having some trouble with reading exception messages (no idea of this is shadow-cljs related, just mentioning it)
When my code hits the following line:
(throw (ex-info (str "Some error") {:info 123} "This is the cause"))
I get this error:
But the {:info 123}
and "This is the cause"
is completely omitted.
However when I run this code in the REPL directly, I get the following error, with all the data intact:
I think it is because the first case is printed by javascript. The second output is in your devtools console which presents values formatted with shadow-cljs custom formatter. You are throwing a clojurescript error, which is a javascript error with some extra clojurescript data attached. Under normal circumstances, this extra cljs data is presented only with the custom formatter - or you would have to do extra work to print it somehow.
fyi. here is the implementation of devtools formatter installed by shadow-cljs: https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/client/console.cljs
@U08E3BBST not sure why thats relevant 😛
@UG9U7TPDZ the repl/invoke shadow-cljs error uses the console to log the error. the other one does not go through "log" and instead is handled by the default handler which just doesn't show the data
@U08E3BBST but the console
stuff in shadow-cljs doesn't have any formatter for errors 😛
The exception is happening within a library, and it's printing it back with ex-info
like I showed in the example code
I've got a macro that works in clojure but not in clojurescript, wondering if I'm trying to do something that won't work because of macro differences. the macro generates a comparator based on a set of keys, e.g. (rec-comparator [:k1 :k2])
will expand to (fn [rec1# rec2#] (compare [(:k1 rec1#) (:k2 rec1#)] [(:k1 rec2#) (:k2 rec2#)]))
(or something close to that). (sort (rec-comparator [:k1 :k2 :k3]) RECORDS)
works in clj, but chokes in cljs, generating a compiler error: java.lang.IllegalArgumentException : Don't know how to create ISeq from: clojure.lang.Symbol .... do macros that generate functions work in clojurescript?
just did -- it's expanding to (fn* ([G__...1 G__...2] (compare ...)))
... extra set of parens looks weird, but this is my first attempt at a clojurescript macro