secretary icon indicating copy to clipboard operation
secretary copied to clipboard

dispatch! not dispatching

Open martinskou opened this issue 11 years ago • 4 comments

Using [org.clojure/clojurescript "0.0-2280"] the following works in [secretary "1.1.1"] but not in [secretary "1.2.0"]

(def history (Html5History.))
(.setUseFragment history false)

(defroute "test" [] 
  (log "TEST")
  (set-html! (js/document.getElementById "main-container") "TEST"))

(events/listen history EventType.NAVIGATE
  (fn [e] (secretary/dispatch! (.-token e))))

(.setEnabled history true)

martinskou avatar Aug 05 '14 06:08 martinskou

@martinskou Hey, I'm not seeing the call to dispatch!? You'll likely want something along the lines of:

(let [h (js/goog.history.Html5History.)]
  (events/listen h EventType.NAVIGATE #(secretary/dispatch! (.-token %)))
  (doto h
    (.setUseFragment false)
    (.setPathPrefix "")
    (.setEnabled true)))

gf3 avatar Aug 06 '14 15:08 gf3

I have updated the original issue, seems some code was missing.

martinskou avatar Aug 11 '14 07:08 martinskou

@martinskou hmm, this is working for me. do you have a failing example somewhere i could poke at?

gf3 avatar Aug 15 '14 16:08 gf3

@martinskou did you get this resolved? anything i can help with?

gf3 avatar Sep 25 '14 20:09 gf3