blob: 667aa6610b74f33b84f6e4fbfe57fa63ffb8974d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Navigation
### Listen to url change
Listen for changes to the current location:
```js
const onLocationChanged = (location) => {
console.log(location.pathname);
console.log(location.query);
console.log(location.hash);
};
module.exports = GitBook.createPlugin({
init: (dispatch, getState, { Navigation }) => {
dispatch(Navigation.listen(onLocationChanged));
}
});
```
The `onLocationChanged` will be triggered for initial state.
|