Make HTTPReq in sci

This commit is contained in:
Michiel Borkent 2021-05-25 13:09:54 +02:00
parent 781d978384
commit ef2eb9a190
2 changed files with 11 additions and 12 deletions

View file

@ -48,15 +48,15 @@
<pre><code class="html">&lt;script type=&quot;application/x-sci&quot; src=&quot;cljs/tictactoe.cljs&quot;&gt;&lt;/script&gt;</code></pre> <pre><code class="html">&lt;script type=&quot;application/x-sci&quot; src=&quot;cljs/tictactoe.cljs&quot;&gt;&lt;/script&gt;</code></pre>
</p> </p>
<pre><code class="language-clojure" id="cljs"></code></pre> <pre><code class="language-clojure" id="cljs"></code></pre>
<script type="text/javascript"> <script type="application/x-sci">
function setText () { (defn set-text [progress-event]
document.getElementById("cljs").innerHTML = (this.responseText); (let [elt (.getElementById js/document "cljs")]
hljs.highlightAll(); (set! (.-innerHTML elt) (.. progress-event -srcElement -responseText))
} (.highlightAll js/hljs)))
var oReq = new XMLHttpRequest(); (def oreq (js/XMLHttpRequest.))
oReq.addEventListener("load", setText); (.addEventListener oreq "load" set-text)
oReq.open("GET", "cljs/tictactoe.cljs"); (.open oreq "GET" "cljs/tictactoe.cljs")
oReq.send(); (.send oreq)
</script> </script>
</body> </body>
</html> </html>

View file

@ -13,9 +13,8 @@
(def js-target-dir (fs/file "gh-pages" "js")) (def js-target-dir (fs/file "gh-pages" "js"))
(fs/create-dirs js-target-dir) (fs/create-dirs js-target-dir)
(when (seq (fs/modified-since js-target-dir "src")) (println "Compiling CLJS")
(println "Compiling CLJS") (shell "clojure -M:dev -m shadow.cljs.devtools.cli release main")
(shell "clojure -M:dev -m shadow.cljs.devtools.cli release main"))
(def index-file (fs/file "gh-pages" "index.html")) (def index-file (fs/file "gh-pages" "index.html"))