PushState (via Html5History from google closure) with secretary, a client-side routing library for clojurescript. Allows to map absolute urls with routes without the hash-bang hackery.
|(def history (Html5History.))|
|(.setUseFragment history false)|
|(.setPathPrefix history "")|
|(.setEnabled history true)|
|(let [navigation (listen history EventType/NAVIGATE)]|
|(let [token (.-token (<! navigation))]|
|(events/listen js/document "click" (fn [e]|
|(let [path (.getPath (.parse Uri (.-href (.-target e))))|
|title (.-title (.-target e))]|
|(when (secretary/any-matches? path)|
|(. history (setToken path title))|
Thanks for this.
In my case, I had spans within my a tags, and the path would not be found, because (-target e) was the span. I fixed this my search up the DOM from the clicked element for an href: