Last active
July 18, 2017 22:04
-
-
Save ioRekz/9492e01e4819a11ce90ea4961a07de33 to your computer and use it in GitHub Desktop.
Revisions
-
ioRekz revised this gist
Jul 18, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ (defn slow-counter [] [:div [:div "Current value counter: " @counter] [:button {:onClick increment} "Increment"]]) (go (while true -
ioRekz revised this gist
Jul 18, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ (defn slow-counter [] [:div [:div "Current value counter: " @counter] [:button {:onClick increment} "Increment with 2s minimum interval"]]) (go (while true -
ioRekz revised this gist
Jul 18, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ (go (while true (<! increment-chan) (swap! counter inc) (<! (async/timeout 2000)))) (reagent/render [slow-counter] js/klipse-container) -
ioRekz created this gist
Jul 18, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ (require '[reagent.core :as reagent]) (require '[cljs.core.async :as async :refer [<! >!]]) (require-macros '[cljs.core.async.macros :refer [go go-loop]]) (def increment-chan (async/chan)) (def counter (reagent/atom 1)) (defn increment [] (async/put! increment-chan 1)) (defn slow-counter [] [:div [:div "Current value counter: " @counter] [:button {:onClick #(increment)} "Increment"]]) (go (while true (<! increment-chan) (<! (async/timeout 3000)) (swap! counter inc))) (reagent/render [slow-counter] js/klipse-container)