Made a lot of progress today: • case • multi-arity functions • interop improvements • fixed examples for Firefox and Safari (by adding shim) ◦ https://twitter.com/borkdude/status/1551985597765615616
@raymcdermott has joined the channel
@borkdude maybe I'm missing something ... is there a simple case of how one would use 🍒 from js?
assume I exposed a function that returned JSON called get-fun-data .... I guess it would be exposed as getFunData and if I called it from ES6 ... hey presto .... the js gets some JSON
[ you might guess that I'm trying to make a CLJ / CLJS library that has interop with various languages without having to write much in those languages ]
[ CLJS in this case ]
@chromalchemy has joined the channel
@raymcdermott You can compile a file like this:
echo '{}' > package.json
npm install cherry-cljs
npx cherry-cljs foo.cljs
and this produces a file foo.mjs which you can then consume from JSget-fun-data is available as get_fun_data currently
(just the munged symbol)
Note that cherry is experimental and not stable, but with that in mind, feel free to try it out and report issues
I do agree that get-fun-data -> getFunData is nicer, so I'll have to write a better munge function myself maybe ;)
Or maybe functions can have some metadata like (defn {:export 'getFunData} get-fun-data []) or so
of course you can also do:
(def getFunData get-fun-data)Thanks for the tips, looks another new pathway!!
@jeffparker has joined the channel