docs: component.onunload was removed

This commit is contained in:
Pat Cavit 2017-01-27 22:58:45 -08:00 committed by GitHub
parent 81efa4db49
commit 49815c6028

View file

@ -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.