This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-12
Channels
- # announcements (1)
- # babashka (67)
- # beginners (39)
- # calva (56)
- # clojure (72)
- # clojure-berlin (3)
- # clojure-boston (1)
- # clojure-europe (10)
- # clojure-nl (1)
- # clojure-norway (67)
- # clojure-uk (5)
- # clojurescript (7)
- # emacs (21)
- # figwheel-main (5)
- # graalvm (24)
- # hyperfiddle (26)
- # missionary (5)
- # music (1)
- # off-topic (21)
- # polylith (4)
- # releases (2)
- # sci (3)
- # shadow-cljs (25)
- # squint (28)
Is this the most reasonable way to pass variable args down into the js world?
([q & args]
(p/let [stmt ^js (.prepare @conn q)
_ (.log js/console stmt args)
q (apply (.bind (.-query stmt) stmt) (map clj->js args))
_ (.close stmt)]
q))
The whole apply
thing feels a bit messy✅ 1
kinda hard to decipher what this is, but JS does have .apply
as well. So likely you don't need this whole bind/apply combo?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
that's basically stmt.query(...args)
oh right. I never thought about the JS's apply, actually.
thanks!