Load html examples from resources
This commit is contained in:
parent
fb828d9958
commit
3991b4868d
4 changed files with 66 additions and 48 deletions
16
resources/public/html/export.html
Normal file
16
resources/public/html/export.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="https://borkdude.github.io/scittle/js/scittle.js" type="application/javascript"></script>
|
||||
<script type="application/x-scittle">
|
||||
(defn my-alert []
|
||||
(js/alert "You clicked!"))
|
||||
;; export function to use from JavaScript:
|
||||
(set! (.-my_alert js/window) my-alert)
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="my_alert()">
|
||||
Click me!
|
||||
</button>
|
||||
</body>
|
||||
</html>
|
||||
25
resources/public/html/reagent.html
Normal file
25
resources/public/html/reagent.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="https://borkdude.github.io/scittle/js/scittle.js" type="application/javascript"></script>
|
||||
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
|
||||
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
|
||||
<script src="https://borkdude.github.io/scittle/js/scittle.reagent.js" type="application/javascript"></script>
|
||||
<script type="application/x-scittle">
|
||||
(require '[reagent.core :as r]
|
||||
'[reagent.dom :as rdom])
|
||||
|
||||
(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!"]]])
|
||||
|
||||
(rdom/render [my-component] (.getElementById js/document "app"))
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue