blob: f0b2077b0aae8e522dd2944b6a9a1de911d50f46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
API: `Location` (object)
==========================
You can supply the router with your own location implementation. The
following methods must be implemented:
Methods
-------
### `setup(onChange)`
Called when the router is first setup. Whenever an external actor should
cause the router to react, call `onChange` (for example, on
`window.hashchange`).
### `teardown`
Called when the router is torn down.
### `push`
Called when the router is transitioning from one path to another.
### `replace`
Called when ther router is replacing (not transitioning) one url with
another.
### `pop`
Called when the router attempts to go back one entry in the history.
### `getCurrentPath`
Should return the current path as a string.
### `toString`
Should return a useful string for logging and debugging.
Example
-------
This is a terrible example, you're probably better off looking at the
implementations in this repository.
```js
var MyLocation = {
setup: function (onChange) {},
teardown: function () {},
push: function (path) {},
replace: function (path) {},
pop: function () {},
getCurrentPath: function () {},
toString: function () {}
};
```
|