all files / src/ request-animation-frame.js

98.81% Statements 83/84
97.67% Branches 42/43
100% Functions 21/21
90% Lines 9/10
26 statements, 11 functions, 22 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22              12×              
/**
 * 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();