cancelAnimFrame function
This commit is contained in:
parent
3ab1acbf56
commit
dfdd363d2e
@ -30,6 +30,9 @@ L.Util = {
|
||||
};
|
||||
}()),
|
||||
|
||||
|
||||
// TODO refactor: remove repetition
|
||||
|
||||
requestAnimFrame: (function () {
|
||||
function timeoutDefer(callback) {
|
||||
window.setTimeout(callback, 1000 / 60);
|
||||
@ -47,11 +50,24 @@ L.Util = {
|
||||
if (immediate && requestFn === timeoutDefer) {
|
||||
callback();
|
||||
} else {
|
||||
requestFn(callback, contextEl);
|
||||
return requestFn.call(window, callback, contextEl);
|
||||
}
|
||||
};
|
||||
}()),
|
||||
|
||||
cancelAnimFrame: (function () {
|
||||
var requestFn = window.cancelAnimationFrame ||
|
||||
window.webkitCancelRequestAnimationFrame ||
|
||||
window.mozCancelRequestAnimationFrame ||
|
||||
window.oCancelRequestAnimationFrame ||
|
||||
window.msCancelRequestAnimationFrame ||
|
||||
clearTimeout;
|
||||
|
||||
return function (handle) {
|
||||
return requestFn.call(window, handle);
|
||||
}
|
||||
}()),
|
||||
|
||||
limitExecByInterval: function (fn, time, context) {
|
||||
var lock, execOnUnlock, args;
|
||||
function exec() {
|
||||
|
Loading…
Reference in New Issue
Block a user