"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../motion-utils/dist-es-errors.cjs");
const syncTime = require("./dist-es-frameloop-sync-time.cjs");
const frame = require("./dist-es-frameloop-frame.cjs");
function delay(callback, timeout) {
  const start = syncTime.time.now();
  const checkElapsed = ({ timestamp }) => {
    const elapsed = timestamp - start;
    if (elapsed >= timeout) {
      frame.cancelFrame(checkElapsed);
      callback(elapsed - timeout);
    }
  };
  frame.frame.read(checkElapsed, true);
  return () => frame.cancelFrame(checkElapsed);
}
exports.delay = delay;
//# sourceMappingURL=dist-es-utils-delay.cjs.map
