 (ns cbfg.world.t1
   (:require-macros [cljs.core.async.macros :refer [go-loop]]
-                   [cbfg.act :refer [act actx-top achan-buf]])
+                   [cbfg.act :refer [act actx-top achan achan-buf aput atake]])
   (:require [cljs.core.async :refer [<! >! close! chan timeout dropping-buffer]]
             [goog.dom :as gdom]
             [om.core :as om :include-macros true]

                  :chs {} ; {ch -> {:id (gen-id), :msgs {msg -> true},
                          ;         :first-taker-actx actx-or-nil}}.
                  :gen-id gen-id})]
        (reset! curr-world {:world world})
        (reset! curr-net {:net-listen-ch (achan-buf world 10)
                          :net-connect-ch (achan-buf world 10)})
        (process-events vis event-delay event-ch step-ch render-ch)
        (make-net world
                  (:net-listen-ch @curr-net)
                  (:net-connect-ch @curr-net))
        (let [prog (get-el-value "prog")
              prog-js (str "with (cbfg.world.t1) {" prog "}")
              prog-res (try (js/eval prog-js) (catch js/Object ex ex))]

                  [21 :event [:a 21]]
                  [22 :event [:b 22]]]}))

(def run-world       (atom {:a 10}))
(def run-world-hover (atom nil))

; -------------------------------------------------------------------

(def curr-world (atom nil)) ; { :world => world-actx
                            ;   :net-listen-ch => ch
                            ;   :net-connect-ch => ch }

; -------------------------------------------------------------------

