Support for skipping redraws (#1049)
Mostly useful for event handlers, setting `e.redraw = false` will prevent mithril from re-rendering.
This commit is contained in:
parent
2ca8fa6e66
commit
04eaa25ab1
4 changed files with 76 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ module.exports = function(callback) {
|
|||
var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout
|
||||
return function(synchronous) {
|
||||
var now = new Date().getTime()
|
||||
if (typeof synchronous === "object" && "redraw" in synchronous && !synchronous.redraw) return
|
||||
if (synchronous === true || last === 0 || now - last >= time) {
|
||||
last = now
|
||||
callback()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue