Last active
November 17, 2023 11:11
-
-
Save mynomoto/dba41fccf1af9d48793142743f8da909 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns view.index | |
| (:require | |
| [hoplon.core :as h] | |
| [javelin.core :as j])) | |
| (def a (j/cell 42)) | |
| (def b (j/cell {:x 100 :y 200})) | |
| (def formulet-test | |
| (j/formulet [v (j/cell= (inc a)) | |
| w (+ 1 2) | |
| {:keys [x y]} b] | |
| (+ v w x y))) | |
| (defn formulet-example | |
| [] | |
| (h/div | |
| (h/h2 "formulet") | |
| ; we should see the formulet value below | |
| (h/div (h/text "formulet value: ~{formulet-test}")) | |
| (h/button :click #(swap! a inc) "a++") | |
| (h/button :click #(swap! a dec) "a--") | |
| (h/button :click #(js/console.log formulet-test) "debug formulet"))) | |
| (.replaceChildren (.getElementById js/document "app") | |
| (formulet-example)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment