Fork me on GitHub
#re-frame
<
2017-03-06
>
isak15:03:51

@victorvoid you need to hang onto the History instance you create, and call setToken on that

isak15:03:46

there it looks like you just create it and throw it away

victorvoid16:03:45

Do you have some example code?

isak16:03:45

@victorvoid

(def history (doto (Html5History.)
               (.setUseFragment false)
               (.setPathPrefix "")
               (.setEnabled true)))

(defn navigate-to [route]
  (let [path (match-route route)]
    (.setToken history (unmatch-pair {:handler (:handler path)
                                      :params (:route-params path)}))))

isak16:03:08

this uses bidi, but should be quite similar for you

isak16:03:20

import: (:import goog.history.Html5History)

victorvoid16:03:17

Thanks very much bro! I'll try, but in my form I use 'preventDefault' and 'navigate-to '/search/?q=test')' right ? but in all view I need put it history ? or only 'navigate-to' ?

victorvoid16:03:13

or it history put only in my routes.cljs ?

isak16:03:17

you just need to make sure any time you interact with history, it is the same instance. we should probably take this to #clojurescript, because it is not really re-frame specific

campeterson18:03:45

@caryfitzhugh Yes, thank you. I ended up doing something similar, but more rudimentary. Your implementation gives me a couple ideas where I can improve. Thanks again!

timgilbert18:03:24

@victorvoid: you might check out pushy for the HTML5 nav stuff, it's just a wrapper around the goog.history stuff but easier to work with IMHO

limist20:03:11

Question for any re-frisk users out there: After installing the library, and putting a call to (enable-re-frisk!) what is supposed to happen? I've done those steps from the doc, and am not seeing any kind of change, like the re-frisk debugger window, or anything else.

isak20:03:01

@limist you should get an icon in the bottom right corner of the page

limist20:03:24

@isak Ah, thanks! Totally missed that. 👀 Had a grey box UI element in the same place, oops.

djanus23:03:19

Just wanted to publicize the release of my re-frame-based desktop app, Smyrna, a search tool for Polish texts. https://github.com/nathell/smyrna