Fork me on GitHub
#clojurescript
<
2020-12-30
>
ackerleytng05:12:31

what's a good way to add a command line option into the code (like defining constants, but let the constant be provided as an option to lein or something)

p-himik10:12:22

Shadow-cljs has this: https://shadow-cljs.github.io/docs/UsersGuide.html#config-merge I don't know if something like this exists in Leiningen but maybe you could use it for some keywords to help you with the search.

Jack Arrington17:12:07

Is there a more elegant interop syntax for this:

element.getBoundingClientRect().width
than this:
(.-width (.getBoundingClientRect elem))
?

phronmophobic20:12:37

also:

(-> elem .getBoundingClientRect .-width)

dpsutton17:12:41

(.. elem (getBoundingClientRect) -width) i think

👍 6
euccastro20:12:25

and the inner parens there are optional, aren't they?

gerred19:12:57

anyone have chance to play with https://hotwire.dev yet?

Erkan22:12:47

What I'm doing wrong here? trying to access the function uniform2f on the js object gl and make a partial function of it with location and then apply the arguments in the list of values

(apply (partial (.-uniform2f gl) location) [1 2 3]) ;; => Uncaught TypeError: Illegal invocation....

p-himik23:12:42

Try wrapping (.-uniform2f gl) in (.bind ... gl).

p-himik23:12:20

Also, with apply you don't need partial - apply accepts multiple arguments.

p-himik23:12:53

Also#2, you can use JS's .apply to avoid having to call .bind.

Erkan11:12:29

after lot's of struggle, thank you so much @U2FRKM4TW!

(.apply gl.uniform2f gl (into-array (cons location values)))

👍 3