fix tests after merge conflict
This commit is contained in:
parent
acd9d5b641
commit
b1e8f61c87
3 changed files with 3 additions and 49 deletions
|
|
@ -1,46 +0,0 @@
|
||||||
var _fns = []
|
|
||||||
var _last = 0
|
|
||||||
var _frame = 1000 / 60
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
setTimeout : function($window) {
|
|
||||||
$window.setTimeout = typeof window === "object" ? window.setTimeout : global.setTimeout;
|
|
||||||
$window.clearTimeout = typeof window === "object" ? window.clearTimeout : global.setTimeout;
|
|
||||||
},
|
|
||||||
|
|
||||||
requestAnimationFrame : function($window) {
|
|
||||||
// Modified version of https://github.com/chrisdickinson/raf
|
|
||||||
// Copyright chrisdickinson I guess?
|
|
||||||
$window.requestAnimationFrame = typeof window === "object" ? window.requestAnimationFrame : function(fn) {
|
|
||||||
if(!_fns.length) {
|
|
||||||
var now = Date.now()
|
|
||||||
var next = Math.max(0, _frame - (now - _last))
|
|
||||||
|
|
||||||
_last = next + now
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
var fns = _fns.slice()
|
|
||||||
|
|
||||||
_fns = []
|
|
||||||
|
|
||||||
for(var i = 0; i < fns.length; i++) {
|
|
||||||
if(typeof fns[i] !== "function") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
fns[i](_last)
|
|
||||||
}
|
|
||||||
}, Math.round(next))
|
|
||||||
}
|
|
||||||
|
|
||||||
_fns.push(fn)
|
|
||||||
|
|
||||||
return _fns.length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$window.cancelAnimationFrame = typeof window === "object" ? window.cancelAnimationFrame : function(handle) {
|
|
||||||
_fns[handle] = null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ o.spec("m.mount", function() {
|
||||||
root = $window.document.body
|
root = $window.document.body
|
||||||
|
|
||||||
renderers = []
|
renderers = []
|
||||||
mount = createMounter($window, renderers)
|
mount = apiMounter($window, renderers)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("pushes a render function", function() {
|
o("pushes a render function", function() {
|
||||||
|
|
@ -31,7 +31,7 @@ o.spec("m.mount", function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
o("renders into `root`", function() {
|
o("renders into `root`", function() {
|
||||||
var mount = createMounter($window, [])
|
var mount = apiMounter($window, [])
|
||||||
|
|
||||||
mount(root, {
|
mount(root, {
|
||||||
view : function() {
|
view : function() {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ o.spec("m.route", function() {
|
||||||
root = $window.document.body
|
root = $window.document.body
|
||||||
|
|
||||||
renderers = []
|
renderers = []
|
||||||
route = apiRouter($window, redraw)
|
route = apiRouter($window, renderers)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("pushes a render function", function() {
|
o("pushes a render function", function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue