0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00
penpot/frontend/uxbox/core.cljs

35 lines
868 B
Text
Raw Normal View History

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