Fork me on GitHub
#funcool
<
2016-10-12
>
kenny00:10:18

Is there a way to get nested observable pushes to evaluate in chronological order rather than their current ordering (by stack frame?). For example, I want @state to be 2, not 1, without changing the order of the code below:

(require '[beicon.core :as rx])
=> nil
(def state (atom 0))
=> #'boot.user/state
(def test-bus (rx/bus))
=> #'boot.user/test-bus
(def sub (rx/subscribe test-bus
                       (fn [f] (f))))
=> #'boot.user/sub
(rx/push! test-bus (fn []
                     (rx/push! test-bus (fn []
                                          (reset! state 2)))
                     (reset! state 1)))
=> nil
@state
=> 1