Minor refactor

This commit is contained in:
Nicholas Kariniemi 2014-09-03 20:18:04 +03:00
parent 4320401a4e
commit 49aa9c784d
2 changed files with 6 additions and 5 deletions

View file

@ -12,8 +12,7 @@
(state/sync-state! from-remote to-remote reset? state-changes)))
(defn init-app []
(let [state-changes (chan)]d
(view/render-app state/state state-changes)
(let [state-changes (view/render-app state/state state-changes)]
(connect-to-server true state-changes)))
(init-app)

View file

@ -25,10 +25,11 @@
(dom/on-document-mousedown #(put! >events {:type :body-mousedown :event %}))
(dom/on-window-scroll #(put! >events {:type :body-scroll :event %}))))))
(defn render-app [state state-changes]
(defn render-app [state]
(let [>events (chan)
<events (a/pub >events :type)
add-grubs-ch (chan)]
add-grubs-ch (chan)
state-changes (chan)]
(om/root app-view
state
{:target (.getElementById js/document "container")
@ -36,4 +37,5 @@
:<events <events
:add-grubs-ch add-grubs-ch}
:tx-listen (fn [{:keys [new-state]} _]
(put! state-changes new-state))})))
(put! state-changes new-state))})
state-changes))