UNPKG

@thi.ng/rstream

Version:

Reactive streams & subscription primitives for constructing dataflow graphs / pipelines

34 lines 1.38 kB
import type { CommonOpts } from "./api.js"; export interface FromRAFOpts extends CommonOpts { /** * Browser only. If true (default: false), passes the timestamps received * via `requestAnimationFrame()` as stream values. If false, a simple * counter `[0,∞)` will be emitted. * * @defaultValue false */ timestamp: boolean; /** * Only used if {@link FromRAFOpts.timestamp} is enabled. If given as * number, the value will be subtracted from all emitted timestamps. If this * option is set to true, the timestamps will be automatically zero-adjusted * such that the first emitted value will be zero. If undefined (default), * the browser supplied timestamps will be used as is. */ t0: number | boolean; } /** * Yields {@link Stream} of a monotonically increasing counter (or timestamps), * triggered by a `requestAnimationFrame()` loop (only available in browser * environments). * * @remarks * In NodeJS, this function falls back to {@link fromInterval}, yielding a * similar (approx. 60Hz) stream (the {@link FromRAFOpts.timestamp} option will * be ignored). * * All subscribers to this stream will be processed during that same RAF loop * iteration. */ export declare const fromRAF: (opts?: Partial<FromRAFOpts>) => import("./stream.js").Stream<number>; //# sourceMappingURL=raf.d.ts.map