Make HTTPReq in sci
This commit is contained in:
parent
781d978384
commit
ef2eb9a190
|
@ -48,15 +48,15 @@
|
|||
<pre><code class="html"><script type="application/x-sci" src="cljs/tictactoe.cljs"></script></code></pre>
|
||||
</p>
|
||||
<pre><code class="language-clojure" id="cljs"></code></pre>
|
||||
<script type="text/javascript">
|
||||
function setText () {
|
||||
document.getElementById("cljs").innerHTML = (this.responseText);
|
||||
hljs.highlightAll();
|
||||
}
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.addEventListener("load", setText);
|
||||
oReq.open("GET", "cljs/tictactoe.cljs");
|
||||
oReq.send();
|
||||
<script type="application/x-sci">
|
||||
(defn set-text [progress-event]
|
||||
(let [elt (.getElementById js/document "cljs")]
|
||||
(set! (.-innerHTML elt) (.. progress-event -srcElement -responseText))
|
||||
(.highlightAll js/hljs)))
|
||||
(def oreq (js/XMLHttpRequest.))
|
||||
(.addEventListener oreq "load" set-text)
|
||||
(.open oreq "GET" "cljs/tictactoe.cljs")
|
||||
(.send oreq)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
(def js-target-dir (fs/file "gh-pages" "js"))
|
||||
(fs/create-dirs js-target-dir)
|
||||
|
||||
(when (seq (fs/modified-since js-target-dir "src"))
|
||||
(println "Compiling CLJS")
|
||||
(shell "clojure -M:dev -m shadow.cljs.devtools.cli release main"))
|
||||
(println "Compiling CLJS")
|
||||
(shell "clojure -M:dev -m shadow.cljs.devtools.cli release main")
|
||||
|
||||
(def index-file (fs/file "gh-pages" "index.html"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue