import type { Clock } from './clock.js'; import type { FrameLoop } from '../types.js'; /** Options for {@link createFrameLoop}. */ export interface FrameLoopOptions { /** Injectable sim-time source (createClock). Default: raw wall-clock deltas. */ clock?: Clock; /** * Cap the loop at a fixed frame rate (fps > 0). Applies a fixed-timestep * accumulator: capped frames always receive delta = 1/fps. NOTE: the cap is * set on the shared FrameLoopManager, so it applies to every loop on the page. */ fps?: number; } /** * Create a frame loop that shares one `requestAnimationFrame` with every other * loop on the page via the framecapper's shared FrameLoopManager. Each loop * keeps its own subscriber set, frame counter, and elapsed time, so * independent loops start/stop without affecting one another; subscribing via * `onFrame` auto-starts the loop. * * @param options - Optional sim clock and fps cap; see {@link FrameLoopOptions}. * @returns A {@link FrameLoop}. `dispose()` stops the loop, clears subscribers, * and terminates every worker update it owns. * @remarks An injected `clock` sub-steps each rAF delta into simulation ticks * (fixed-step determinism). Worker updates registered through * `registerWorkerUpdate` coalesce ticks latest-wins while the worker is busy — * `delta` sums, `elapsed`/`frame` jump. The `fps` cap is set on the shared * manager, so it applies globally to every loop on the page, not just this one. * @see {@link FrameLoop} */ export declare function createFrameLoop({ clock: simClock, fps }?: FrameLoopOptions): FrameLoop; //# sourceMappingURL=frame-loop.d.ts.map