wip
This commit is contained in:
parent
a488900e23
commit
848dd52d3c
3 changed files with 25 additions and 17 deletions
|
|
@ -33,6 +33,6 @@ Idea by Arne Brasseur a.k.a [plexus](https://github.com/plexus).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright © 2021 Michiel Borkent
|
Copyright © 2021 - 2022 Michiel Borkent
|
||||||
|
|
||||||
Distributed under the EPL License. See LICENSE.
|
Distributed under the EPL License. See LICENSE.
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,6 @@
|
||||||
(.append
|
(.append
|
||||||
(js/document.createTextNode "there")))))
|
(js/document.createTextNode "there")))))
|
||||||
|
|
||||||
|
(defn foo [])
|
||||||
|
|
||||||
(js/alert "Isn't this cool? :)")
|
(js/alert "Isn't this cool? :)")
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@
|
||||||
(def state (r/atom {:clicks 0}))
|
(def state (r/atom {:clicks 0}))
|
||||||
|
|
||||||
(defn my-component []
|
(defn my-component []
|
||||||
[:div
|
[:div
|
||||||
[:p "Clicks: " (:clicks @state)]
|
[:p "Clicks: " (:clicks @state)]
|
||||||
[:p [:button {:on-click #(swap! state update :clicks inc)}
|
[:p [:button {:on-click #(swap! state update :clicks inc)}
|
||||||
"Click me!"]]])
|
"Click me!"]]])
|
||||||
|
|
||||||
(rdom/render [my-component] (.getElementById js/document "app"))
|
(rdom/render [my-component] (.getElementById js/document "app"))
|
||||||
|
|
||||||
|
|
@ -41,15 +41,15 @@
|
||||||
|
|
||||||
(require '[goog.object :as gobject])
|
(require '[goog.object :as gobject])
|
||||||
(doseq [code code-tags]
|
(doseq [code code-tags]
|
||||||
(let [src (.getAttribute code "data-src")
|
(let [src (.getAttribute code "data-src")
|
||||||
req (js/XMLHttpRequest.)]
|
req (js/XMLHttpRequest.)]
|
||||||
(.open req "GET" src true)
|
(.open req "GET" src true)
|
||||||
(set! (.-onload req)
|
(set! (.-onload req)
|
||||||
(fn []
|
(fn []
|
||||||
(let [response (gobject/get req "response")]
|
(let [response (gobject/get req "response")]
|
||||||
(set! (.-innerText code) response)
|
(set! (.-innerText code) response)
|
||||||
(.highlightElement js/hljs code))))
|
(.highlightElement js/hljs code))))
|
||||||
(.send req)))
|
(.send req)))
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="float: right;">
|
<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>
|
<h1>Scittle</h1>
|
||||||
<h2>What is this?</h2>
|
<h2>What is this?</h2>
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
To embed scittle in your website, it is recommended to use the links
|
To embed scittle in your website, it is recommended to use the links
|
||||||
published to
|
published to
|
||||||
the <a href="https://github.com/babashka/scittle/releases/tag/v0.1.2">releases
|
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
|
Include <tt>scittle.js</tt> and write a <tt>script</tt> tag
|
||||||
where <tt>type</tt> is set
|
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:
|
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">
|
<pre><code id="scittle-tag-example" class="html">
|
||||||
<script src="cljs/script.cljs" type="application/x-scittle"></script>
|
<script src="cljs/script.cljs" type="application/x-scittle"></script>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<script type="text/javascript">hljs.highlightElement(document.getElementById("scittle-tag-example"));</script>
|
<script type="text/javascript">hljs.highlightElement(document.getElementById("scittle-tag-example"));</script>
|
||||||
|
|
@ -118,6 +118,12 @@
|
||||||
Click me!
|
Click me!
|
||||||
</button>
|
</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>
|
<a name="examples"></a>
|
||||||
<h2><a href="#examples">Examples</a></h2>
|
<h2><a href="#examples">Examples</a></h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue