cljs routing

58 views
Skip to first unread message

Daniel Fitzpatrick

unread,
Feb 20, 2018, 5:30:40 PM2/20/18
to Luminus
Started playing around with core.cljs generated by the template.  In a SPA, how can I hook secretary/dispatch! to the browser's navigation history?

In other words:

(secretary/dispatch! "/")
(secretary/dispatch! "/other_page")




And then I press the browser's back button to return to "/"

Daniel Fitzpatrick

unread,
Feb 21, 2018, 12:07:50 AM2/21/18
to Luminus
Looks like I need to use html5 pushState and onPopState. A couple of wrappers are available: pushy and accountant. They look about the same except under the covers.

Anyone have a preference?

Daniel Fitzpatrick

unread,
Feb 21, 2018, 12:13:20 AM2/21/18
to Luminus
I'm leaning toward Pushy. I like it's idea of a component-style record.

Daniel Fitzpatrick

unread,
Feb 21, 2018, 6:07:42 PM2/21/18
to Luminus
I didn't like how pushy and accountant both modified the behavior of `<a>` tags and introduced their own attributes, so I wrote my own solution which doesn't do that.  I might release it, because surely we need another html5 history wrapper.
Reply all
Reply to author
Forward
0 new messages