nandi/jolt-nativepublic Fork 0
121e5f1d751e8003ea229e70debf486b9bea3286
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.

glimmer-cosmic: a libcosmic backend for glimmer (spike) 6a3304d · on 121e5f1d751e8003ea229e70debf486b9bea3286 · nandi · 8d ago
smoke.clj · 25 lines · 1.0 KBClojure Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(ns glimmer-cosmic.smoke
  "Non-interactive: opens the window, re-renders from a timer on the worker
  while libcosmic paints, prints the tree, and quits. Exercises the parts of
  this backend that differ from glimmer-vidya — mounting before the loop, the
  worker, schedule, commit, and quit from off the main thread."
  (:require [glimmer.ratom :as r :refer [atom]]
            [glimmer.core :as ui]
            [glimmer-cosmic.core :as backend]))

(def ticks (atom 0))

(defn app []
  [:page {:max-width 420}
   [:card {}
    [:title {:label "smoke"}]
    [:label {:label (str "ticks: " @ticks)}]
    [:progress {:value (/ (min @ticks 10) 10.0) :label "re-rendering from a timer"}]
    [:checkbutton {:label "a checkbox" :active (odd? @ticks)}]
    [:entry {:placeholder "an entry"}]]])

(defn -main [& _]
  (backend/every! 100 #(swap! ticks inc))
  (backend/after! 1500 #(do (backend/dump!) (backend/quit!)))
  (ui/run app :title "glimmer-cosmic smoke" :width 480 :height 360)
  (println "run returned; ticks =" @ticks))