#686 prevent redraw lock on error
This commit is contained in:
parent
04911d38a5
commit
505d7b930d
3 changed files with 18 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1 @@
|
|||
node_modules
|
||||
archive
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ module.exports = function(grunt) {
|
|||
"mithril",
|
||||
"mithril.computation",
|
||||
"mithril.deferred",
|
||||
"mithril.module",
|
||||
"mithril.mount",
|
||||
"mithril.component",
|
||||
"mithril.prop",
|
||||
"mithril.redraw",
|
||||
"mithril.render",
|
||||
|
|
|
|||
28
mithril.js
28
mithril.js
|
|
@ -615,21 +615,25 @@ var m = (function app(window, undefined) {
|
|||
if (redrawing) return;
|
||||
redrawing = true;
|
||||
if (force) forcing = true;
|
||||
//lastRedrawId is a positive number if a second redraw is requested before the next animation frame
|
||||
//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 ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {
|
||||
if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);
|
||||
lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET);
|
||||
try {
|
||||
//lastRedrawId is a positive number if a second redraw is requested before the next animation frame
|
||||
//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 ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {
|
||||
if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);
|
||||
lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET);
|
||||
}
|
||||
}
|
||||
else {
|
||||
redraw();
|
||||
lastRedrawId = $requestAnimationFrame(function() { lastRedrawId = null; }, FRAME_BUDGET);
|
||||
}
|
||||
}
|
||||
else {
|
||||
redraw();
|
||||
lastRedrawId = $requestAnimationFrame(function() { lastRedrawId = null; }, FRAME_BUDGET);
|
||||
finally {
|
||||
redrawing = forcing = false;
|
||||
}
|
||||
redrawing = forcing = false;
|
||||
};
|
||||
m.redraw.strategy = m.prop();
|
||||
function redraw() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue