1
我project.clj如下:調用自定義JavaScript函數clojurescript
(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;
}
如何調用這個js函數從clojurescript文件內?我試圖通過以下方式調用此功能:
(js/calculate 4 5 6)
但是,這並不奏效。謝謝。
非常感謝你。這工作很好。 – artella