cljs-cheatsheet
cljs-cheatsheet copied to clipboard
Improve JavaScript Interop
- Ideally,
#js {}
and#js []
should also have a tooltip (which should also highlight the differences from js-obj) - there should be section:
Construct JS objects
new .
(new js/Date args*) (module.MyType. args*)`
Possibly also explicitly document js/
to explain/remind that it is used to access variables in the global scope?
Also ^:export
should be perhaps mentioned?
Perhaps also mention goog.object/set, get
(that are advanced-compilation save variants of .-
, now that aset
can truly only be used for arrays)
Good ideas :+1: I have been thinking for a while now that the interop section could be improved.
Ideally, #js {} and #js [] should also have a tooltip (which should also highlight the differences from js-obj)
What are the differences between #js {}
and js-obj
?
-
js-obj
only works correctly with string keys. -
#js {}
accepts keywords and transforms them into strings:#js {:prop 123} => {"prop": 123}