Skip to content

Commit a342d36

Browse files
committed
Update Location docs
Fixes #639
1 parent 75c6206 commit a342d36

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

docs/api/misc/Location.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Methods
1111

1212
Adds a function to the location that should be called when it changes.
1313

14+
### `removeChangeListener(listener)`
15+
16+
Stop calling the given function when the location changes.
17+
1418
### `push`
1519

1620
Called when the router is transitioning from one path to another.
@@ -33,21 +37,15 @@ This method should be ready to go immediately after setup.
3337

3438
Should return a useful string for logging and debugging.
3539

36-
Example
40+
History
3741
-------
3842

39-
For examples of how to implement your own location, please see the locations
40-
included in this repository.
43+
Additionally, location objects must:
4144

45+
- Increment `ReactRouter.History.length` immediately **after** the URL changes
46+
- Decrement `ReactRouter.History.length` immediately **before** going back to the
47+
previous URL
4248

43-
```js
44-
var MyLocation = {
45-
addChangeListener: function (listener) {},
46-
push: function (path) {},
47-
replace: function (path) {},
48-
pop: function () {},
49-
getCurrentPath: function () {}
50-
};
49+
Please refer to the [built-in location objects][locations] to get an idea for how this is done.
5150

52-
Router.run(routes, MyLocation, callback);
53-
```
51+
[locations]: /modules/locations

0 commit comments

Comments
 (0)