Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active April 5, 2021 02:17
Show Gist options
  • Save mfikes/575e56fb55ba9027193e4ed0ae942b19 to your computer and use it in GitHub Desktop.
Save mfikes/575e56fb55ba9027193e4ed0ae942b19 to your computer and use it in GitHub Desktop.
Example of foreign library property namespace

Example using library property namespace with a foreign lib:

clj -M -m cljs.main -co co.edn -re node -r
ClojureScript 1.10.844
cljs.user=> (require '[yq$yowza :as yz :refer [getMessage]])
nil
cljs.user=> (getMessage)
"Hello, world!"
cljs.user=> (yz/sayHello "hola")
hola
nil
{:output-to "out/main.js"
:foreign-libs [{:file "yayquery.js"
:provides ["yq" "yq$yowza"]
:global-exports {yq yayLib}}]}
{:deps {org.clojure/clojurescript {:mvn/version "1.10.844"}}}
var yayLib = {
yowza: {
sayHello: function (message) {
console.log(message);
},
getMessage: function () {
return "Hello, world!";
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment