update docs re:onbeforeremove and clean up

This commit is contained in:
Leo Horie 2016-12-26 12:28:13 -05:00
parent 78b9a082ac
commit bedcd8bdbf
5 changed files with 14 additions and 18 deletions

View file

@ -249,9 +249,9 @@ Hook | Description
`oninit(vnode)` | Runs before a vnode is rendered into a real DOM element
`oncreate(vnode)` | Runs after a vnode is appended to the DOM
`onupdate(vnode)` | Runs every time a redraw occurs while the DOM element is attached to the document
`onbeforeremove(vnode, done)` | Runs before a DOM element is removed from the document, and only triggers the actual removal of the DOM element when the `done` callback is called. This method is only triggered on the element that is detached from its parent DOM element, but not on its child elements.
`onbeforeremove(vnode)` | Runs before a DOM element is removed from the document. If a Promise is returned, Mithril only detaches the DOM element after the promise completes. This method is only triggered on the element that is detached from its parent DOM element, but not on its child elements.
`onremove(vnode)` | Runs before a DOM element is removed from the document. If a `onbeforeremove` hook is defined, `onremove` is called after `done` is called. This method is triggered on the element that is detached from its parent element, and all of its children
`onbeforeupdate(vnode, old)` | Runs before `onupdate` and if it returns `false`, it prevents a diff for the element and all of its children
`onbeforeupdate(vnode, old)` | Runs before `onupdate` and if it returns `false`, it prevents a diff for the element and all of its children
To learn more about lifecycle methods, [see the lifecycle methods page](lifecycle-methods.md).