Make m.redraw() strictly asynchronous
This commit is contained in:
parent
38956e119b
commit
b004c20f0c
11 changed files with 281 additions and 111 deletions
24
test-utils/throttleMock.js
Normal file
24
test-utils/throttleMock.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
module.exports = function() {
|
||||
var queue = []
|
||||
return {
|
||||
throttle: function(fn) {
|
||||
var pending = false
|
||||
return function() {
|
||||
if (!pending) {
|
||||
queue.push(function(){
|
||||
pending = false
|
||||
fn()
|
||||
})
|
||||
pending = true
|
||||
}
|
||||
}
|
||||
},
|
||||
fire: function() {
|
||||
queue.forEach(function(fn) {fn()})
|
||||
queue.length = 0
|
||||
},
|
||||
queueLength: function(){
|
||||
return queue.length
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue