import "../motion-utils/dist-es-errors.js";
import { time } from "./dist-es-frameloop-sync-time.js";
import { frame, cancelFrame } from "./dist-es-frameloop-frame.js";
function delay(callback, timeout) {
  const start = time.now();
  const checkElapsed = ({ timestamp }) => {
    const elapsed = timestamp - start;
    if (elapsed >= timeout) {
      cancelFrame(checkElapsed);
      callback(elapsed - timeout);
    }
  };
  frame.read(checkElapsed, true);
  return () => cancelFrame(checkElapsed);
}
export {
  delay
};
//# sourceMappingURL=dist-es-utils-delay.js.map
