This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-25
Channels
- # architecture (12)
- # asami (6)
- # aws (2)
- # babashka (2)
- # beginners (71)
- # bristol-clojurians (1)
- # calva (1)
- # cider (2)
- # clojure (136)
- # clojure-australia (6)
- # clojure-dev (14)
- # clojure-europe (11)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-sanfrancisco (29)
- # clojure-uk (9)
- # clojuredesign-podcast (12)
- # clojurescript (23)
- # code-reviews (7)
- # core-logic (5)
- # cryogen (7)
- # datomic (7)
- # depstar (7)
- # events (3)
- # fulcro (11)
- # helix (1)
- # jobs (2)
- # juxt (4)
- # kaocha (25)
- # leiningen (2)
- # malli (11)
- # off-topic (8)
- # pathom (1)
- # pedestal (9)
- # portkey (1)
- # reitit (3)
- # ring (2)
- # sci (46)
- # shadow-cljs (21)
- # tools-deps (15)
- # xtdb (31)
is ctx
in sci a mutable thing? It’s stored in an atom here https://github.com/babashka/xterm-sci/blob/a8e16f35a2b77a006b64f90e5a40f3a39e3c9f94/src/xterm_sci/core.cljs#L28 but I can’t see where it’s being reset!
?
there are reasons to do this, if you e.g. use functions in the opts that need the ctx, so you will have a circular dependency. I often use a volatile for this
and setting :classes {'js goog/global}
should make js/
work just like in bootstrap cljs?
it works to a degree, but it's best to write some tests for that to verify the details of that. I'm not an expert in CLJS interop :)
The example is hosted here, so you can try: https://babashka.org/xterm-sci/
I was confused at first that js/window
interpreted in sci is the same as a bining {'js-window js/window}
but that’s probably because I don’t understand dynamic scope
not sure I do, given the opts {:classes {'js js/window} :bindings {'js-window js/window}}
@mkvlr you can also mock out all the objects you want to give access to like this: https://github.com/borkdude/sci/blob/c2045f5e56f6c52f05921eaff9d70d64ac971c98/test/sci/interop_test.cljc#L94
so maybe then this is the best option: https://github.com/babashka/xterm-sci/blob/a8e16f35a2b77a006b64f90e5a40f3a39e3c9f94/src/xterm_sci/core.cljs#L17
then you don't need this right? :bindings {'js-window js/window}
- that's the part I'm confused about
I notice this works in cljs:
cljs.user=> js/location.href
" "
but in sci this currently doesn't:
user=> js/location.href
nil
user=> (.-href js/location)
" "
user=>
If you want to allow everything, you will probably also need to add: https://github.com/babashka/xterm-sci/blob/37bd9bceb38c1e76a40ce584fc2b4fbdc201bd36/src/xterm_sci/core.cljs#L18
I think we can fix this in sci, but I'm not sure if js/document.body
is officially supported by CLJS (although it obviously works)
I think that should already be supported by default in sci. It doesn't work for you?
https://github.com/borkdude/sci/issues/449 & https://github.com/borkdude/sci/issues/450