Skip to content

Instantly share code, notes, and snippets.

@dbushenko
Created June 8, 2014 08:08
Show Gist options
  • Save dbushenko/65ff9e5e315000e34725 to your computer and use it in GitHub Desktop.
Save dbushenko/65ff9e5e315000e34725 to your computer and use it in GitHub Desktop.
(def current-page (atom nil))
(def history (History.))
(defn change-page [newPage]
(.setToken history newPage)
(reset! current-page newPage))
...
(defn start []
(secretary/set-config! :prefix "#")
(goog.events/listen history EventType/NAVIGATE #(secretary/dispatch! (.-token %)))
(add-navbar)
; TODO: use server push
(js/setInterval #(sync-user-data nil) 3000)
(.setEnabled history true))
(set! (.-onload js/window) #(em/wait-for-load (sync-user-data start)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment