docs: component.onunload was removed
This commit is contained in:
parent
81efa4db49
commit
49815c6028
1 changed files with 35 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ If you are migrating, consider using the [mithril-codemods](https://www.npmjs.co
|
|||
- [Reading/writing the current route](#readingwriting-the-current-route)
|
||||
- [Accessing route params](#accessing-route-params)
|
||||
- [Preventing unmounting](#preventing-unmounting)
|
||||
- [Run code on component removal](#run-code-on-component-removal)
|
||||
- [`m.request`](#mrequest)
|
||||
- [`m.deferred` removed](#mdeferred-removed)
|
||||
- [`m.sync` removed](#msync-removed)
|
||||
|
|
@ -489,6 +490,40 @@ var Component = {
|
|||
|
||||
---
|
||||
|
||||
## Run code on component removal
|
||||
|
||||
Components no longer call `this.onunload` when they are being removed. They now use the standardized lifecycle hook `onremove`.
|
||||
|
||||
### `v0.2.x`
|
||||
|
||||
```javascript
|
||||
var Component = {
|
||||
controller: function() {
|
||||
this.onunload = function(e) {
|
||||
// ...
|
||||
}
|
||||
},
|
||||
view: function() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `v1.x`
|
||||
|
||||
```javascript
|
||||
var Component = {
|
||||
onremove : function() {
|
||||
// ...
|
||||
}
|
||||
view: function() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## m.request
|
||||
|
||||
Promises returned by [m.request](request.md) are no longer `m.prop` getter-setters. In addition, `initialValue`, `unwrapSuccess` and `unwrapError` are no longer supported options.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue