Fork me on GitHub
#clojurescript
<
2023-02-27
>
Gerome16:02:15

Hello! I'm trying to access a cljs namespace within a JavaScript Runtime in iOS. It should be possible, JavaScriptCore is made for stuff like that and after loading my bundled main.js I have goog in my global scope. However, running goog.require('hello-world.core') returns undefined. I'm compiling my code using clj -M -m cljs.main --target node --output-to main.js --optimizations simple -c hello-world.core and the file I compiled is a very simple hello world file with one function that I would like to run. The presence of goog and also goog.require tells me that the file was successfully evaluated. However, how do I access that function in the namespace?

p-himik17:02:31

AFAIK CLJS namespaces don't become goog modules, unless maybe if you compile the code in some particular way. But if you need something specific stuff from some specific namespace, you can always manually export it.

Gerome17:02:08

Right! I forgot to use ^export :man-facepalming::skin-tone-2:

Alex Miller (Clojure team)17:02:56

Hello, the annualhttps://www.surveymonkey.com/r/clojure2023 is now open! This survey has been done every year since 2010 and has been instrumental in tracking changes in the Clojure community over time. We would greatly appreciate it if you could complete this by March 13th! It takes about 10 minutes and almost all questions are optional.

18
🎉 5
✔️ 2