You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
485 B

var raf = function raf(callback) {
return +setTimeout(callback, 16);
};
var caf = function caf(num) {
return clearTimeout(num);
};
if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
raf = function raf(callback) {
return window.requestAnimationFrame(callback);
};
caf = function caf(handle) {
return window.cancelAnimationFrame(handle);
};
}
export default function wrapperRaf(callback) {
return raf(callback);
}
wrapperRaf.cancel = caf;