src/common/transition/index.js
function nextFrame(fn) {
    let frame;
    let cancelFrame;

    if (window.requestAnimationFrame) {
        frame = requestAnimationFrame(() => {
            frame = requestAnimationFrame(fn);
        });
        cancelFrame = cancelAnimationFrame;
    } else {
        frame = setTimeout(fn, 26); // 16ms to simulate RAF, 10ms to ensure called after the frame.
        cancelFrame = clearTimeout;
    }

    return () => {
        if (frame) {
            cancelFrame(frame);
            frame = undefined;
        }
    };
}
function nextFrame(fn) {
    let frame;
    let cancelFrame;

    if (window.requestAnimationFrame) {
        frame = requestAnimationFrame(() => {
            frame = requestAnimationFrame(fn);
        });
        cancelFrame = cancelAnimationFrame;
    } else {
        frame = setTimeout(fn, 26); // 16ms to simulate RAF, 10ms to ensure called after the frame.
        cancelFrame = clearTimeout;
    }

    return () => {
        if (frame) {
            cancelFrame(frame);
            frame = undefined;
        }
    };
}
function nextFrame ( fn ) { let frame ; let cancelFrame ; if ( window . requestAnimationFrame ) { frame = requestAnimationFrame ( ( ) => { frame = requestAnimationFrame ( fn ) ; } ) ; cancelFrame = cancelAnimationFrame ; } else { frame = setTimeout ( fn , 26 ) ; // 16ms to simulate RAF, 10ms to ensure called after the frame. cancelFrame = clearTimeout ; } return ( ) => { if ( frame ) { cancelFrame ( frame ) ; frame = undefined ; } } ; }
Runs a function during the next animation frame.

@param {function} fn a function to run on the next animation frame.
@return {function} a function to cancel the callback.
Runs a function during the next animation frame .