added optional param to m.redraw() to allow forced update

This commit is contained in:
Zolmeister 2014-08-13 12:59:03 -07:00
parent d567de08a8
commit 774be35cc2
3 changed files with 42 additions and 4 deletions

View file

@ -406,10 +406,10 @@ Mithril = m = new function app(window, undefined) {
m.endComputation()
}
}
m.redraw = function() {
m.redraw = function(force) {
var cancel = window.cancelAnimationFrame || window.clearTimeout
var defer = window.requestAnimationFrame || window.setTimeout
if (lastRedrawId) {
if (lastRedrawId && !force) {
cancel(lastRedrawId)
lastRedrawId = defer(redraw, 0)
}