Created
April 8, 2015 17:02
-
-
Save auramo/e6b3b299e3cbb989721a to your computer and use it in GitHub Desktop.
This file contains 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 example.core | |
(:require [reagent.core :as reagent :refer [atom]])) | |
(enable-console-print!) | |
(defonce atom1 (atom 1)) | |
(defonce atom2 (atom 2)) | |
(defn handle-file [root stat next] | |
(println "handle file") | |
(reset! output (str @output root "/" (.-name stat) "\n")) | |
(next)) | |
(defn mod-atom-1 [a1] | |
(swap! atom1 inc @a1)) | |
(defn mod-atom-2 [a2] | |
(swap! atom2 inc @a2)) | |
(defn show-atom1 [a1] | |
(println "SHOW atom1") | |
[:h1 (str "Atom1: " @a1)]) | |
(defn show-atom2 [a2] | |
(println "Show atom2") | |
[:h1 (str "Atom2: " @a2)]) | |
(defn app [] | |
[:div | |
[:h2 "Atom Shell ClojureScript Tester"] | |
[:button {:name "mod atom1" :on-click #(mod-atom-1 atom1)} "Mod atom 1"] | |
[:button {:name "mod atom2" :on-click #(mod-atom-2 atom2)} "Mod atom 2"] | |
[:div (show-atom1 atom1)] | |
[:div (show-atom2 atom2)]]) | |
(reagent/render [app] (.-body js/document)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment