fix errors

This commit is contained in:
Leo Horie 2014-09-19 00:02:26 -04:00
parent 3984ce17eb
commit d80b898b98

View file

@ -460,14 +460,15 @@ Mithril = m = new function app(window, undefined) {
m.redraw = function(force) {
var cancel = window.cancelAnimationFrame || window.clearTimeout
var defer = window.requestAnimationFrame || window.setTimeout
var delay = new Date - lastRedrawCallTime
//lastRedrawId is a positive number if a second redraw is requested before the next animation frame
//lastRedrawId is -1 if the redraw is the first one in a event handler (see #151)
//lastRedrawID is null if it's the first redraw and not an event handler
if (lastRedrawId && force !== true) {
//when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout
//when rAF: always reschedule redraw
if (new Date - lastRedrawCallTime > FRAME_BUDGET || defer == window.requestAnimationFrame) {
if (lastRedrawID > 0) cancel(lastRedrawId)
if (delay > FRAME_BUDGET || defer == window.requestAnimationFrame) {
if (lastRedrawId > 0) cancel(lastRedrawId)
lastRedrawId = defer(redraw, delay)
}
}