ProgressValue (src/progress-value.ts)

react-kino · packages/core/src/progress-value.ts · typescript · MIT
ui

* Listener invoked whenever a {@link ProgressValue} changes. */

// Source: https://github.com/btahir/react-kino | License: MIT | Copyright 2026 Bilal Tahir
// Provided via justclaw.it.com; keep this notice with the code.
/** Listener invoked whenever a {@link ProgressValue} changes. */
export type ProgressListener = (value: number) => void;

/**
 * A tiny, React-free "motion value" primitive.
 *
 * Holds a single numeric progress value (typically 0→1) and notifies
 * subscribers imperatively when it changes. This is the backbone of
 * react-kino's ref-based rendering engine: components subscribe with
 * {@link ProgressValue.on} and write to the DOM directly inside the callback,
 * bypassing React's render cycle entirely on the scroll hot path.
 *
 * Design notes:
 * - Zero dependencies (no React), so it can live in `@react-kino/core`.
 * - `set` is a n

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key