You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-20Lines changed: 36 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,23 @@
1
1
# cyclic-router
2
-
cyclic-router is a Router Driver built for Cycle.js
2
+
cyclic-router V5 is a routing library built for Cycle.js. Unlike previous versions, cyclic-router V5 is not a driver. It is a `main` function-wrapper which relies on @cycle/history for driver source/sink interactions
3
3
4
-
**Disclaimer** Use v4 for Cycle Unified. v2.x.x is for Cycle and v3 is for Cycle Diversity.
5
-
If you are still using @cycle/core please continue to use v1.x.x
4
+
For older versions of cyclic-router, V4 and earlier please go to the old [README](https://github.com/cyclejs-community/cyclic-router/README_V4.md)
6
5
7
6
## Installation
8
7
9
8
Using [npm](https://www.npmjs.com/):
10
9
11
10
$ npm install --save cyclic-router
12
11
13
-
Versions 3 and 4 requires users to inject the route matcher. We'll use `switch-path` for our examples but other
14
-
matching libraries could be adapted to be used here:
12
+
Cyclic router requires you to inject the route matcher. We'll use `switch-path` for our examples but other matching libraries could be adapted to be used here:
15
13
16
14
$ npm install --save switch-path
17
-
18
-
Note: Version 2 and below use `switch-path` for the route matcher always and the above library install is not necesssary/done implicitly.
19
-
20
-
Then with a module bundler like [browserify](http://browserify.org/), use as you would anything else:
history:makeHistoryDriver() //create history driver as usual,
63
+
//but it gets proxied by routerify
66
64
});
67
65
```
66
+
### Routerify Options
67
+
68
+
Routerify accepts an options object like so: `routerify(main, options)`
69
+
70
+
The `options` object conforms to the interface:
71
+
```
72
+
interface RouterOptions {
73
+
basename?: string;
74
+
historyName?: string;
75
+
routerName?: string;
76
+
omitHistory?: boolean;
77
+
}
78
+
```
79
+
80
+
-`basename` - The root router path, defaults to `/`
81
+
-`historyName` - The source/sink name associated with the raw history river, defaults to `history`
82
+
-`routerName` - The source/sink name you want exposed to your app which caputures the functionality/streams associated with routerify. Defaults to `router`
83
+
-`omitHistory` - Routerify hides the source/sink name associated with the raw history driver (given in the `historyName` option) from your app and only exposes the source/sink name associated with the router (given in the `routerName` option). Defaults to `true`, If you would like your app to have access to both the raw `history` source/sink and the `router` source/sink (injected by routerify), set this option to `false`
This behavior changes based on the injected route matcher. In the case of `switch-path`, you can pass route parameters to your component by adding them to the component sources.
0 commit comments