Last active
October 27, 2016 19:45
-
-
Save geraldodev/3928745a47ab9f337e90e73057b5a548 to your computer and use it in GitHub Desktop.
Escutando atom, pra capturar a transição :is-open de false para true. Observe que na linha 5 eu uso a desestruturação de mapa sem keys, porque quero fazer com que :is-open do estado anterior fique na variável was-open. A linha 6 já captura o is-open atual
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
(add-watch state-atom :watch | |
(fn [k | |
r | |
{was-open :is-open} | |
{:keys [is-open input-value]}] | |
(cond | |
(and | |
(not was-open) | |
is-open | |
(empty? input-value) | |
(not (.get cache ""))) | |
(do | |
(println "asking head..") | |
(async/put! input-chan ""))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment