Unverified Commit ccaf640b authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Document router events the way they are used (#3268)

parent dc07cd1b
...@@ -474,15 +474,15 @@ This uses of the same exact parameters as in the `<Link>` component. ...@@ -474,15 +474,15 @@ This uses of the same exact parameters as in the `<Link>` component.
You can also listen to different events happening inside the Router. You can also listen to different events happening inside the Router.
Here's a list of supported events: Here's a list of supported events:
- `routeChangeStart(url)` - Fires when a route starts to change - `onRouteChangeStart(url)` - Fires when a route starts to change
- `routeChangeComplete(url)` - Fires when a route changed completely - `onRouteChangeComplete(url)` - Fires when a route changed completely
- `routeChangeError(err, url)` - Fires when there's an error when changing routes - `onRouteChangeError(err, url)` - Fires when there's an error when changing routes
- `beforeHistoryChange(url)` - Fires just before changing the browser's history - `onBeforeHistoryChange(url)` - Fires just before changing the browser's history
- `appUpdated(nextRoute)` - Fires when switching pages and there's a new version of the app - `onAppUpdated(nextRoute)` - Fires when switching pages and there's a new version of the app
> Here `url` is the URL shown in the browser. If you call `Router.push(url, as)` (or similar), then the value of `url` will be `as`. > Here `url` is the URL shown in the browser. If you call `Router.push(url, as)` (or similar), then the value of `url` will be `as`.
Here's how to properly listen to the router event `routeChangeStart`: Here's how to properly listen to the router event `onRouteChangeStart`:
```js ```js
Router.onRouteChangeStart = url => { Router.onRouteChangeStart = url => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment