[英]How to show generated JS in Clojurescript REPL?
在關於core.async的演示文稿中 ,Timothy Baldridge負責ClojureScript Browser REPL,並將生成的JavaScript從Emacs發送到Web瀏覽器。
當我在這里完成Austin(Clojurescript REPL)步驟時 ,我沒有像我在視頻中看到的那樣生成JavaScript。 我錯過了什么?
我的問題是: 如何在Clojurescript REPL中顯示生成的JS?
如果您通過啟用Cc Ce nrepl-eval-last-expression
emacs-cider中的clojure [script]代碼,您將獲得相同的效果。
此外,您可以重用相同的代碼https://github.com/halgari/clojure-conj-2013-core.async-examples
注意你必須首先加載這個指令
(require 'cljs.repl.browser)
(cemerick.piggieback/cljs-repl
:repl-env (cljs.repl.browser/repl-env :port 9000))
然后重新加載瀏覽器並嘗試此操作以確認您已連接
(js/alert "We're running ClojureScript")
您將在瀏覽器中收到提醒
以下是Timothy Baldridge會議的project.clj定義
(defproject clojure-conj-talk "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:plugins [[lein-cljsbuild "1.0.0-alpha2"]]
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/core.async "0.1.256.0-1bf8cf-alpha"]
[http-kit "2.1.10"]
[cheshire "5.2.0"]
[org.clojure/clojurescript "0.0-2014"]
[com.cemerick/austin "0.1.3"]]
:profiles {:dev {:repl-options {:init-ns user}
:plugins [[com.cemerick/austin "0.1.0"]
[lein-cljsbuild "0.3.2"]]
:cljsbuild {:builds [{:source-paths ["src-cljs"]
:compiler {:output-to "app.js"
:optimizations :simple
:pretty-print true}}]}}})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.