This commit is contained in:
Leo Horie 2016-10-26 11:17:16 -04:00
parent 04ffdae2a3
commit 4b40d2d3b5
3 changed files with 52 additions and 1 deletions

24
docs/redraw.md Normal file
View file

@ -0,0 +1,24 @@
# redraw()
- [API](#api)
- [How it works](#how-it-works)
---
### API
`m.redraw()`
Argument | Type | Required | Description
----------- | -------------------- | -------- | ---
**returns** | | | Returns nothing
---
### How it works
When callbacks outside of Mithril run, you need to notify Mithril's rendering engine that a redraw is needed. External callbacks could be `setTimeout`/`setInterval`/`requestAnimationFrame` callbacks, web socket library callbacks, event handlers in jQuery plugins, third party XHR request callbacks, etc.
To trigger a redraw, call `m.redraw()`
You should not call m.redraw from a [lifecycle method](lifecycle-methods.md). Doing so will result in undefined behavior.