0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-26 16:39:49 -05:00
penpot/exporter/src/app/core.cljs
2020-07-01 13:41:59 +02:00

36 lines
784 B
Clojure

(ns app.core
(:require
[lambdaisland.glogi :as log]
[lambdaisland.glogi.console :as glogi-console]
[promesa.core :as p]
[app.http :as http]
[app.config]
[app.browser :as bwr]))
(glogi-console/install!)
(enable-console-print!)
(defonce state (atom nil))
(defn start
[& args]
(log/info :msg "initializing")
(p/let [browser (bwr/start!)
server (http/start! {:browser browser})]
(reset! state {:http server
:browser browser})))
(def main start)
(defn stop
[done]
;; an empty line for visual feedback of restart
(js/console.log "")
(log/info :msg "stoping")
(p/do!
(when-let [instance (:browser @state)]
(bwr/stop! instance))
(when-let [instance (:http @state)]
(http/stop! instance))
(done)))