import type { Resource } from "webappwiz/disposable"; import type { Clock, Duration } from "webappwiz/time"; /** * A frame that has been asked for: await `promise` for it to run, or dispose * it to give it up. Disposing does nothing once the callback has started. */ export interface Frame extends Resource { /** Resolves once the callback has run, or once the frame is disposed. */ promise: Promise; } /** * Runs `callback` on the next animation frame, handing it how long it waited. * * ```ts * const frame = raf(clock, (dt) => advance(dt)); * await frame.promise; * ``` */ export declare function raf(clock: Clock, callback: (dt: Duration) => void | Promise): Frame;