This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-05
Channels
- # announcements (1)
- # asami (21)
- # aws (19)
- # babashka (37)
- # beginners (38)
- # clj-kondo (7)
- # clj-otel (8)
- # clojure (29)
- # clojure-europe (54)
- # clojure-nl (3)
- # clojure-spec (2)
- # clojure-uk (2)
- # clojurescript (15)
- # conjure (1)
- # data-science (1)
- # datomic (21)
- # emacs (6)
- # events (3)
- # figwheel-main (1)
- # gratitude (13)
- # holy-lambda (11)
- # joyride (6)
- # klipse (3)
- # malli (14)
- # missionary (26)
- # nbb (31)
- # omni-trace (2)
- # pathom (3)
- # reagent (1)
- # reitit (1)
- # releases (1)
- # shadow-cljs (24)
- # sql (27)
- # tools-deps (4)
- # vim (21)
Hi. I wonder why the first does not work. And how is it compiled to js.
;; ; Cannot read properties of undefined (reading 'lineAt')
(let [editor ^js vscode/window.activeTextEditor]
(.lineAt editor.document
vscode/window.activeTextEditor.selection.active.line))
(let [editor ^js vscode/window.activeTextEditor]
(.lineAt (.-document editor)
vscode/window.activeTextEditor.selection.active.line))
I don’t know why these behave differently. But since this is #joyride the code is never compiled to JavaScript. It's interpreted by #sci .
It seems like ts/js now has default arguments. Is it possible in cljs? For example, vscode api has default arguments.
It has been possible for a long time:
(defn f [{:keys [a b c] :or {b :some-default-value}}]
...)
I don't think there's any special interop need for this.
If you have e.g. function f(a, b=1) {}
in JS and call it as (f 3)
from CLJS, it should use the default value.
what about function f(a=0,b=1)
and call it in cljs with the intention of only supplying the value of b
?
> You can’t do that in JS, can you? Just tested indeed I cannot do that. Then regarding the image I posted (the vscode api, what’s the default value mean since I must specify the arguments anyway?)