export const startFrameLoop = (fn) => {
    let handle = 0;
    let preTime = 0;
    const run = () => {
        handle = requestAnimationFrame(time => {
            try {
                fn(time - preTime);
            }
            finally {
                preTime = time;
                run();
            }
        });
    };
    run();
    return () => {
        cancelAnimationFrame(handle);
    };
};
//# sourceMappingURL=frame-loop.js.map