This commit is contained in:
Michiel Borkent 2022-05-17 14:24:51 +02:00
parent a488900e23
commit 848dd52d3c
3 changed files with 25 additions and 17 deletions

View file

@ -33,6 +33,6 @@ Idea by Arne Brasseur a.k.a [plexus](https://github.com/plexus).
## License
Copyright © 2021 Michiel Borkent
Copyright © 2021 - 2022 Michiel Borkent
Distributed under the EPL License. See LICENSE.

View file

@ -10,4 +10,6 @@
(.append
(js/document.createTextNode "there")))))
(defn foo [])
(js/alert "Isn't this cool? :)")

View file

@ -19,10 +19,10 @@
(def state (r/atom {:clicks 0}))
(defn my-component []
[:div
[:p "Clicks: " (:clicks @state)]
[:p [:button {:on-click #(swap! state update :clicks inc)}
"Click me!"]]])
[:div
[:p "Clicks: " (:clicks @state)]
[:p [:button {:on-click #(swap! state update :clicks inc)}
"Click me!"]]])
(rdom/render [my-component] (.getElementById js/document "app"))
@ -41,15 +41,15 @@
(require '[goog.object :as gobject])
(doseq [code code-tags]
(let [src (.getAttribute code "data-src")
req (js/XMLHttpRequest.)]
(.open req "GET" src true)
(set! (.-onload req)
(fn []
(let [response (gobject/get req "response")]
(set! (.-innerText code) response)
(.highlightElement js/hljs code))))
(.send req)))
(let [src (.getAttribute code "data-src")
req (js/XMLHttpRequest.)]
(.open req "GET" src true)
(set! (.-onload req)
(fn []
(let [response (gobject/get req "response")]
(set! (.-innerText code) response)
(.highlightElement js/hljs code))))
(.send req)))
</script>
@ -60,7 +60,7 @@
</head>
<body>
<div style="float: right;">
<a href="https://gitHub.com/babashka/scittle"><img src="https://img.shields.io/github/stars/babashka/scittle.svg?style=social&label=Star"></a></div>
<a href="https://gitHub.com/babashka/scittle"><img src="https://img.shields.io/github/stars/babashka/scittle.svg?style=social&label=Star"></a></div>
<h1>Scittle</h1>
<h2>What is this?</h2>
@ -73,7 +73,7 @@
To embed scittle in your website, it is recommended to use the links
published to
the <a href="https://github.com/babashka/scittle/releases/tag/v0.1.2">releases
page</a>.
page</a>.
Include <tt>scittle.js</tt> and write a <tt>script</tt> tag
where <tt>type</tt> is set
@ -90,7 +90,7 @@
When you have a file on your server, say <tt>cljs/script.cljs</tt>, you can load it using the <tt>src</tt> attribute:
<pre><code id="scittle-tag-example" class="html">
&lt;script src=&quot;cljs/script.cljs&quot; type=&quot;application/x-scittle&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;cljs/script.cljs&quot; type=&quot;application/x-scittle&quot;&gt;&lt;/script&gt;
</code></pre>
<script type="text/javascript">hljs.highlightElement(document.getElementById("scittle-tag-example"));</script>
@ -118,6 +118,12 @@
Click me!
</button>
<a name="repl"></a>
<h2><a href="#nrepl">REPL</a></h2>
To connect to a REPL with Scittle,
see <a href="https://github.com/babashka/scittle/blob/main/README.md#repl">README.md</a>
<a name="examples"></a>
<h2><a href="#examples">Examples</a></h2>
<ul>