Skip to content
Permalink
2bbf460234
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
39 lines (34 sloc) 1.1 KB
(ns ulysses.core
(:require [reagent.core :as reagent]
[re-frame.core :as re-frame :refer [dispatch dispatch-sync]]
[ulysses.handlers]
[ulysses.subs]
[ulysses.routes :as routes]
[ulysses.views :as views]
[ulysses.config :as config]
[ulysses.lib.analytics :as analytics]))
(when config/debug?
(println "dev mode"))
(defn mount-root []
(reagent/render [views/main-app]
(.getElementById js/document "app")))
(defn hook-into-browser-events []
(.addEventListener js/window "resize"
(fn [] (dispatch [:window-resize])))
(.addEventListener js/window "scroll"
(fn [] (dispatch [:window-scroll]))))
(defn start-pollings []
(let [pollings [[100 [:window-resize]]
[(* 30 1000) [:request-user-poll]]]]
(doseq [[time dval] pollings]
(dispatch-sync dval)
(js/setInterval
(fn [] (dispatch dval))
time))))
(defn ^:export init []
(analytics/start)
(routes/app-routes)
(dispatch-sync [:initialize-db])
(mount-root)
(hook-into-browser-events)
(start-pollings))