import React from "react";
const refreshInterval = 500;
export function createEventLoopDelaySampler() {
    const [lastKnownTime, setLastKnownTime] = React.useState(performance.now());
    const [delay, setDelay] = React.useState(0);
    React.useEffect(() => {
        const interval = setInterval(() => {
            const now = performance.now();
            const delay = now - lastKnownTime - refreshInterval;
            setLastKnownTime(now);
            setDelay(delay);
        }, refreshInterval);
        return () => {
            clearInterval(interval);
        };
    }, [lastKnownTime]);
    return delay;
}
//# sourceMappingURL=measure-event-loop-delay.js.map