venantius / accountant

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

Feature request: unlisten to NAVIGATE event #57

Closed tomjkidd closed 5 years ago

tomjkidd commented 5 years ago

Hello,

First I'd like to say thank you for maintaining this library! I was curious if you would consider providing the ability to un-configure (probably not the best name) navigation.

For the current implementation, the series of calls from configure-navigation! to dispatch-on-navigate, to goog.events/listen creates a listener that can't be released, and it'd be nice to have a way to un-register it.

My use case is that for our project using this, we create a system component, using https://github.com/stuartsierra/component, and when a user logs out, we'd like to unlisten to the NAVIGATE event in this case so that we can clean up all of the handlers that our system creates. We have a workaround, using goog.events/removeAll, but this makes it so that we have to know more about the implementation than we'd like to, and if your library would take on the responsibility, it'd be more pleasant to use.

Thanks for your consideration!

venantius commented 5 years ago

Hi there!

This seems like a totally reasonable feature request. Would you be open to submitting a PR for it, given that you've already got a workaround that you're using?

iku000888 commented 5 years ago

:+1:

This is a valid request hearing that more frontend work is build on component/integrant these days. Seems like a simply adding an alias to goog.events/removeAll under accountant's namespace would do the job based on the description.

tomjkidd commented 5 years ago

Alright, I created PR, https://github.com/venantius/accountant/pull/58, note that I didn't use removeAll (one of the events is on js/document).

venantius commented 5 years ago

Resolved.

Cisneiros commented 5 years ago

Hi! Do you plan on releasing a version containing this feature soon? I couldn't find one

venantius commented 5 years ago

I do but I'm afraid my laptop with my signing keys is "in the shop", so to speak. It'll be at least a week before I'm able to :(