| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1× 1× 1× 1× 1× 12× 1× 1× | /**
* requestAnimationFrame provider, with polyfill
*/
function native() {
Eif (window) {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame;
}
return undefined;
}
function polyfill() {
return (callback, element, delay) => {
setTimeout(callback, delay || (1000 / 60), new Date().getTime());
};
}
function createRequestAnimationFrame() {
return native() || polyfill();
}
export default createRequestAnimationFrame();
|