Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request #107

Closed
cultulhul opened this issue Apr 13, 2017 · 8 comments
Closed

feature request #107

cultulhul opened this issue Apr 13, 2017 · 8 comments

Comments

@cultulhul
Copy link

i would like to request a hook that runs when you are about to navigate away from a route regardless of the route your navigating to

@krasimir
Copy link
Owner

Is it possible to use the before hook and simply apply same function to all the routes?

@cultulhul
Copy link
Author

yes it is but its not convenient it only needs to run on two routes and they might be some use cases for others were its not possible to do it that way

@krasimir
Copy link
Owner

Ok, I'll think about beforeAll and afterAll hooks.

@cultulhul
Copy link
Author

Ok, i think a hook that runs when you are about to navigate away from a route would also also be needed in cases were you have many routes that need the to run code specific to them, a beforeAll would involve too many checks to see what is the current route

@krasimir
Copy link
Owner

Well isn't it you are about to navigate away means you are about to enter another one. So beforeAll is de-facto what we need.

@cultulhul
Copy link
Author

they are similar but i think their is a need for both a beforeAll hook would be great in scenarios were the code you want to run applies to all routes, if you have many routes that have code specific to them a onLeave hook makes more sense eg in a single page app where the their are many different event listener tied to the html of the specific routes using a beforeAll to remove them would involve checking to see what route your on first while using a onLeave hook you could just remove then as the code will only run on the specific route

@asmer
Copy link

asmer commented May 10, 2017

I wanna beforeAll and afterAll for common operations too. I will be grateful for that feature :)

krasimir pushed a commit that referenced this issue May 21, 2017
@krasimir
Copy link
Owner

4.8.0 version released. It contains generic hooks + leave hook.

P.S.
Sorry for the delay @asmer @cultulhul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants