Combine duplicate sections

This commit is contained in:
Pat Cavit 2016-09-12 11:03:44 -07:00 committed by GitHub
parent 1cd0ec0cd2
commit e334b5026f

View file

@ -9,11 +9,10 @@
- [Component arguments](#component-arguments)
- [Passing components to `m()`](#passing-components-to-m)
- [Passing vnodes to `m.mount()` and `m.route()`](#passing-vnodes-to-mmount-and-mroute)
- [`m.route` mode](#mroute-mode)
- [`m.route.mode`](#mroutemode)
- [`m.route` and anchor tags](#mroute-and-anchor-tags)
- [Reading/writing the current route](#readingwriting-the-current-route)
- [Accessing route params](#accessing-route-params)
- [Setting route prefix](#setting-route-prefix)
- [m.request](#mrequest)
## `m.component` removed
@ -226,9 +225,23 @@ m.route(element, '/', {
})
```
## `m.route` mode
## `m.route.mode`
`m.route.mode` was replaced by `m.route.prefix(prefix)` where `prefix` can be `#`, `?`, or an empty string (for "pathname" mode). The new API also supports hashbang (`#!`), which is the default, and it supports non-root pathnames and arbitrary mode variations such as querybang (`?!`)
In `v0.2.x` the routing mode could be set by assigning a string of `"pathname"`, `"hash"`, or `"search"` to `m.route.mode`. In `v.1.x` it is replaced by `m.route.prefix(prefix)` where `prefix` can be `#`, `?`, or an empty string (for "pathname" mode). The new API also supports hashbang (`#!`), which is the default, and it supports non-root pathnames and arbitrary mode variations such as querybang (`?!`)
### `v0.2.x`
```js
m.route.mode = "pathname";
m.route.mode = "search";
```
### `v1.x`
```js
m.route.prefix("");
m.route.prefix("?");
```
## `m.route()` and anchor tags
@ -309,22 +322,6 @@ m.route(document.body, "/booga", {
});
```
## Setting route prefix
In `v0.2.x` the route prefix could be set by assigning a string of `"pathname"`, `"hash"`, or `"search"` to `m.route.mode`. In `v1.x` this has been replaced by `m.route.prefix` which is a setter function. Passing it an empty string is analogous to using pathname mode. Other options include passing `"#"` for hash and `"?"` for search.
### `v0.2.x`
```js
m.route.mode = "pathname";
```
### `v1.x`
```js
m.route.prefix("");
```
## m.request
[m.request](request.md) now returns an [m.prop stream](prop.md) instead of a promise. The main difference is you'll have to use `.run` to get similar functionality as a promise's `.then`: