#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
|
node_modules
|
||||||
archive
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ module.exports = function(grunt) {
|
||||||
"mithril",
|
"mithril",
|
||||||
"mithril.computation",
|
"mithril.computation",
|
||||||
"mithril.deferred",
|
"mithril.deferred",
|
||||||
"mithril.module",
|
"mithril.mount",
|
||||||
|
"mithril.component",
|
||||||
"mithril.prop",
|
"mithril.prop",
|
||||||
"mithril.redraw",
|
"mithril.redraw",
|
||||||
"mithril.render",
|
"mithril.render",
|
||||||
|
|
|
||||||
28
mithril.js
28
mithril.js
|
|
@ -615,21 +615,25 @@ var m = (function app(window, undefined) {
|
||||||
if (redrawing) return;
|
if (redrawing) return;
|
||||||
redrawing = true;
|
redrawing = true;
|
||||||
if (force) forcing = true;
|
if (force) forcing = true;
|
||||||
//lastRedrawId is a positive number if a second redraw is requested before the next animation frame
|
try {
|
||||||
//lastRedrawID is null if it's the first redraw and not an event handler
|
//lastRedrawId is a positive number if a second redraw is requested before the next animation frame
|
||||||
if (lastRedrawId && force !== true) {
|
//lastRedrawID is null if it's the first redraw and not an event handler
|
||||||
//when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout
|
if (lastRedrawId && force !== true) {
|
||||||
//when rAF: always reschedule redraw
|
//when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout
|
||||||
if ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {
|
//when rAF: always reschedule redraw
|
||||||
if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);
|
if ($requestAnimationFrame === window.requestAnimationFrame || new Date - lastRedrawCallTime > FRAME_BUDGET) {
|
||||||
lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET);
|
if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);
|
||||||
|
lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
redraw();
|
||||||
|
lastRedrawId = $requestAnimationFrame(function() { lastRedrawId = null; }, FRAME_BUDGET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
finally {
|
||||||
redraw();
|
redrawing = forcing = false;
|
||||||
lastRedrawId = $requestAnimationFrame(function() { lastRedrawId = null; }, FRAME_BUDGET);
|
|
||||||
}
|
}
|
||||||
redrawing = forcing = false;
|
|
||||||
};
|
};
|
||||||
m.redraw.strategy = m.prop();
|
m.redraw.strategy = m.prop();
|
||||||
function redraw() {
|
function redraw() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue