- Notifications
You must be signed in to change notification settings - Fork135
add reference/javascript-interop-ref.adoc#95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Convert some of the Java lingo to Javascript (e.g. s/instance/object/)FIXME indicates places where content is missing or verifiedDELETE indicates code from the clj doco that i think does not apply to cljsSigned-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
Signed-off-by: Gregg Reynolds <reynolds-gregg@norc.org>
@mobileink Thanks! This draft is looking pretty good! I'd be happy to contribute when you get to the point where you are interested in feedback. |
Thanks for reminding me. Life intervened, but I hope to get back to this soon. |
I am very much looking forward to this, we really need this guide. Any way other people can help you,@mobileink ? |
Non-goals: | ||
* user guide - that goes in link:../guides/javascript-interop-guide.adoc[Javascript Interop Guide] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
(when somebody creates it :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
the guide could well be based onhttp://funcool.github.io/clojurescript-unraveled/#host-interoperability (and the partly outdatedhttp://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/)
---- | ||
#js {:a 1 :b 2} | ||
-> #js {:a 1, :b 2} | ||
(js-obj :a 1 :b 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think that forjs-obj
we need to use string keys, otherwise we end up with the js object{ ':a': 1, ':b': 2 }
, which likely is not desriable. Worth pointing out that#js
converts:kwd -> "kwd"
(and::kwd -> ":kwd"
.
We should also mentioned that#js
is not recursive, i.e. I need#js {:child #js {:isKid true} :isParent true}
has (proto)types, objects, field properties, and method properties. | ||
In the following, we will drop "property" and refer to "fields" and | ||
"methods". | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
also remind the user that objects in the global context need to be accessed viajs/
, contrary to the direct access in JS itself?
TODO: make this readable | ||
For interacting with Javascript objects, use `goog.object` rather than `aget` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Perhaps also mentionhttps://github.com/binaryage/cljs-oops as an alternative? It is already mentioned at cljs.info/cheatsheet/
Special form. | ||
The args, if any, are evaluated from left to right, and passed to the constructor of the class named by Classname. The constructed object is returned. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
- this:
Note that if Typename is defined within a module, you simply prepend the module name with a dot, just as you would do in #"json" data-turbo="false" action="/clojure/clojurescript-site/pull/95/review_comment/162802557" accept-charset="UTF-8" method="post">
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
[8]ページ先頭
First draft