【发布时间】:2014-09-21 18:35:45
【问题描述】:
我正在尝试在浏览器中启动 ClojureScript REPL。理想情况下,我还不想使用 Austin:我首先想让最简单的 REPL 工作。
我尝试了各种教程,但到目前为止我还没有成功。基本上我不明白人们说“启动 ClojureScript 浏览器 REPL”是什么意思。
到目前为止,我做到了:
lein new mies hellow
还有:
lein cljsbuild auto hellow
这是我的 core.js 文件:
(ns hellow.core
(:require [clojure.browser.repl :as repl]))
(enable-console-print!)
(println "Hello world!")
(. js/console (log "Hello again"))
(repl/connect "http://localhost:9000/repl")
(. js/console (log "Ah, this prints too"))
当我打开我的 index.html(调用 core.js)时,我可以在 Chrome 的开发人员工具的 JavaScript 控制台中看到所有内容都已正确记录。
但是(repl/connect ...) 显然失败了。以下是 Chrome 的开发者工具显示的内容;
Failed to load resource http://localhost:9000/repl?xpc=%7B%22cn%22%...
在我读到的关于 ClojureScript 的几乎所有论坛帖子/博客文章/教程中,我都偶然发现了这样一句话:“启动浏览器 REPL” 或类似的内容。
如何启动浏览器 REPL?这是必须在 从浏览器加载 index.html 之前完成的事情吗?
我可以从 Emacs 启动这个浏览器 REPL 吗?
如何在不加载 index.html / core.js 的情况下测试浏览器 REPL 是否正常工作?
在浏览器中加载 index.html / core.js 之后,我如何验证 (repl/connect ...) 里面的 core.js 确实有效并且实际上已连接到 REPL?
【问题讨论】:
-
看看无花果和栗子。这些将使启动浏览器 repl 更容易
标签: browser emacs read-eval-print-loop clojurescript