Merge remote-tracking branch 'origin/rewrite' into rewrite
Conflicts: docs/keys.md docs/signatures.md docs/v1.x-migration.md index.js ospec/bin/ospec.cmd request/request.js request/tests/test-xhr.js util/prop.js util/tests/index.html util/tests/test-prop.js
This commit is contained in:
commit
bce2abbffd
107 changed files with 1989 additions and 1970 deletions
|
|
@ -227,7 +227,7 @@ To learn more about components, [see the components page](components.md).
|
|||
|
||||
### Lifecycle methods
|
||||
|
||||
Vnodes and components can have lifecycle methods (also known as *hooks*), which are called at various points during the lifetime of a DOM element. The lifecycle methods supported by Mithril are: `oninit`, `oncreate`, `onupdate`, `onbeforeremove`, `onremove`, and `onbeforeupdate`.
|
||||
Vnodes and components can have lifecycle methods (also known as *hooks*), which are called at various points during the lifetime of a DOM element. The lifecycle methods supported by Mithril are: `oninit`, `oncreate`, `onupdate`, `onbeforeremove`, `onremove`, and `onbeforeupdate`.
|
||||
|
||||
Lifecycle methods are defined in the same way as DOM event handlers, but receive the vnode as an argument, instead of an Event object:
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ m("ul", users.map(function(u) { // <ul>
|
|||
})) // </ul>
|
||||
|
||||
// ES6:
|
||||
// m("ul", users.map(u =>
|
||||
// m("ul", users.map(u =>
|
||||
// m("li", u.name)
|
||||
// ))
|
||||
```
|
||||
|
|
@ -390,7 +390,7 @@ var BadListComponent = {
|
|||
for (var i = 0; i < vnode.attrs.items.length; i++) {
|
||||
list.push(m("li", vnode.attrs.items[i]))
|
||||
}
|
||||
|
||||
|
||||
return m("ul", list)
|
||||
}
|
||||
}
|
||||
|
|
@ -407,4 +407,4 @@ var BetterListComponent = {
|
|||
}))
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue