cljs-cheatsheet icon indicating copy to clipboard operation
cljs-cheatsheet copied to clipboard

Improve JavaScript Interop

Open holyjak opened this issue 7 years ago • 2 comments

  • 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)

holyjak avatar Jan 22 '18 10:01 holyjak

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 ?

oakmac avatar Jan 22 '18 16:01 oakmac

  • js-obj only works correctly with string keys.
  • #js {} accepts keywords and transforms them into strings: #js {:prop 123} => {"prop": 123}

holyjak avatar Jan 22 '18 20:01 holyjak