nandi/jolt-nativepublic Fork 0
16408ca25dde0dc34bec4930ba79a6cf5adedc0c
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

counter.jolt · 21 lines · 702 BText Blame HistoryRaw
Bind the terminal backend from the side that renders into it 3cfee15 nandi 17d ago1(ns glimmer-tui.counter
2 "The smallest thing that shows the backend works: a number and two buttons.
3
4 The same component renders under glimmer-vidya in a window. Nothing here
5 names a terminal."
6 (:require [glimmer.ratom :as r :refer [atom]]
7 [glimmer.core :as ui]
8 [glimmer-tui.core]))
9
10(defonce n (atom 0))
11
12(defn counter []
13 [:vbox {:spacing 1 :margin 2}
14 [:title {:label "counter"}]
15 [:label {:label (str "n = " @n)}]
16 [:hbox {:spacing 2}
17 [:button {:label "-" :on-click #(swap! n dec)}]
18 [:button {:label "+" :kind :primary :on-click #(swap! n inc)}]]
19 [:dim-label {:label "tab moves, enter presses, ctrl-q quits"}]])
20
21(defn -main [& _] (ui/run counter))