venantius / accountant

ClojureScript navigation for single-page applications, made simple.
Eclipse Public License 1.0
250 stars 39 forks source link

Optionally emit a navigation event when a link to the current page is clicked #54

Closed AdamNiederer closed 6 years ago

AdamNiederer commented 6 years ago

This is enabled by setting :reload-same-path? to true in when calling configure-navigation!

iku000888 commented 6 years ago

Thanks! Could you provide some example usages?

AdamNiederer commented 6 years ago

I've added some documentation to the README. My current use case is making all links scroll the browser to the top of the page via the nav handler (this doesn't work on links to the current page on master). I'm assuming this behaviour would be useful with other types of navigation hooks as well, or perhaps for resetting the current page's state via a link.

iku000888 commented 6 years ago

Thanks for the explanation! I think it is an option worth adding. Lemme test this patch in one of my projects...

iku000888 commented 6 years ago

Can confirm the patch works and breaks nothing in my project. @venantius I think this would be a good enhancement. Thoughts?

venantius commented 6 years ago

This seems like a reasonable request to me. One clarifying question, just to make sure I'm understanding - clicking the same link won't trigger a full reload, right? It'll just emit an event?

AdamNiederer commented 6 years ago

This seems like a reasonable request to me. One clarifying question, just to make sure I'm understanding - clicking the same link won't trigger a full reload, right? It'll just emit an event?

That's correct

AdamNiederer commented 6 years ago

Thanks for the feedback - I've addressed each comment in the above commits.

venantius commented 6 years ago

LGTM! Thanks :)