This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-14
Channels
- # announcements (3)
- # babashka-sci-dev (22)
- # beginners (6)
- # calva (36)
- # cljsrn (1)
- # clojure (59)
- # clojure-europe (31)
- # clojure-france (3)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-uk (4)
- # clojurescript (6)
- # conjure (1)
- # cursive (11)
- # data-oriented-programming (1)
- # datahike (2)
- # docker (8)
- # duct (4)
- # emacs (1)
- # figwheel-main (5)
- # kaocha (1)
- # leiningen (8)
- # lsp (64)
- # malli (10)
- # membrane (5)
- # nrepl (11)
- # off-topic (5)
- # portal (6)
- # quil (9)
- # reagent (62)
- # reitit (15)
- # releases (3)
- # ring-swagger (2)
- # shadow-cljs (36)
- # specter (2)
- # tools-deps (21)
What is preferred, and why is their is 2 ways to do this? A:
(cy.add #js {:data #js {:id "4" :label "INP\ntgt"}})
B:
(.add cy #js {:data #js {:id "2" :label "INP\ntgt"}})
?
Are they really just equivalent ?As far as I know B is the real intended way. Version A is to let people who come from JavaScript feel more at home.
Don't use cy.add
unless add
is already in the externs: https://clojure.atlassian.net/browse/CLJS-3315
Personally, I use it only with js/console.log
- because log
is certainly in externs (built-in JS API) and I use that function very often (typing (.log js/console ...)
requires a tad more mental effort).
@U2FRKM4TW FWIW any length of js/whatever.x.y.z
is safe in shadow-cljs. it just generates externs for all properties assuming its all ^js
.
👍 3