0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00
penpot/frontend/uxbox/core.cljs

35 lines
868 B
Text
Raw Normal View History

2015-06-18 12:35:50 -05:00
(ns uxbox.core
2015-12-17 09:43:58 -05:00
(:require [beicon.core :as rx]
[cats.labs.lens :as l]
[uxbox.state :as st]
[uxbox.router :as rt]
2015-12-14 07:17:18 -05:00
[uxbox.rstore :as rs]
2015-12-17 09:43:58 -05:00
[uxbox.ui :as ui]
[uxbox.data.load :as dl]))
2015-06-18 12:35:50 -05:00
(enable-console-print!)
(defn main
"Initialize the storage subsystem."
[]
(let [lens (l/select-keys [:pages-by-id
2015-12-29 08:51:47 -05:00
:shapes-by-id
2015-12-24 12:32:10 -05:00
:colors-by-id
:projects-by-id])
stream (->> (l/focus-atom lens st/state)
(rx/from-atom)
2015-12-28 13:06:26 -05:00
(rx/debounce 1000)
(rx/tap #(println "[save]")))]
(rx/on-value stream #(dl/persist-state %))))
2015-12-14 16:57:47 -05:00
(defonce +setup+
2015-12-14 07:17:18 -05:00
(do
(println "bootstrap")
(st/init)
(rt/init)
2015-12-17 05:51:36 -05:00
(ui/init)
2015-12-14 16:57:47 -05:00
(rs/emit! (dl/load-data))
(main)))