我的project.clj如下:
(defproject cljsbuild-example-simple "0.3.2"
:description "A simple example of how to use lein-cljsbuild"
:source-paths ["src-clj"]
:dependencies [[org.clojure/clojure "1.5.1"]
[compojure "1.0.4"]
[hiccup "1.0.0"]]
:plugins [[lein-cljsbuild "0.3.2"]
[lein-ring "0.7.0"]]
:cljsbuild {
:builds [{:source-paths ["src-cljs"]
:compiler {:output-to "resources/public/js/main.js"
:libs ["src-js/jsfuncs.js"]
:optimizations :whitespace
:pretty-print true}}]}
:ring {:handler example.routes/app})
jsfuncs.js包含以下代码:
function calculate(a,b,c) {
d = (a+b) * c;
return d;
}
如何从 clojurescript 文件中调用此 js 函数?我试图通过以下方式调用此函数:
(js/calculate 4 5 6)
但这没有用。谢谢。