Skip to content

Instantly share code, notes, and snippets.

@dimovich
Last active February 28, 2018 18:51
Show Gist options
  • Save dimovich/12c0ec251c5cffc48d1d6cccfa4fa555 to your computer and use it in GitHub Desktop.
Save dimovich/12c0ec251c5cffc48d1d6cccfa4fa555 to your computer and use it in GitHub Desktop.
(re-frame/reg-event-db
:db/initialize-iota
(fn [db [_ v]]
(let [state (make-state)]
(assoc db :state state))))
(re-frame/reg-event-fx
:db/initialize-iota-mam
(fn [{{:keys [state] :as db} :db} _]
{:db db
:dispatch [:db/change-state state]})
(re-frame/reg-event-fx
:db/change-state
(fn [{db :db} [_ state]]
(let [new-state (change-state state)]
{:db (assoc db :state new-state)
:db/stateful-fn state})))
(re-frame/reg-fx
:db/stateful-fn
(fn [state]
...))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment