/** * Internal helpers shared by media composables (1.14+). * * Provides a small `createMediaSignal()` factory that standardises SSR * safety, idempotent `destroy()`, and `AbortSignal` teardown so individual * composables can focus on their event wiring. * * @internal * @module bquery/media */ import type { MediaSignalHandle } from './types'; /** * Options accepted by every 1.14+ media composable for auto-teardown. * * @internal */ export interface AbortableOptions { /** * Optional `AbortSignal`. When the signal aborts the composable destroys * itself, matching the convention adopted by `@bquery/bquery/motion` in 1.13. */ signal?: AbortSignal; } /** * Shared factory that wraps a writable signal in the standard * {@link MediaSignalHandle} shape, attaches a single `destroy()` * implementation, and wires an optional `AbortSignal`. * * @param initial - The initial value of the signal. * @param setup - Called immediately when the DOM is available. Must return * a cleanup function (or `undefined`) that detaches any * listeners or browser-side observers. * @param options - Optional configuration (currently just `signal`). * @returns - The readonly handle exposed to user code. * * @internal */ export declare const createMediaSignal: (initial: T, setup: (set: (value: T) => void) => (() => void) | void, options?: AbortableOptions) => MediaSignalHandle; /** * Returns `true` when running inside a DOM-capable environment. * @internal */ export declare const hasDom: () => boolean; /** * Writable counterpart of {@link createMediaSignal}. * * Returns both the readonly handle and a `set()` writer so internal helpers * (e.g. {@link useWakeLock}) can update the signal in response to imperative * API calls outside of the `setup` closure. * * @internal */ export declare const createWritableMediaSignal: (initial: T, setup?: (set: (value: T) => void) => (() => void) | void, options?: AbortableOptions) => { handle: MediaSignalHandle; set: (value: T) => void; destroy: () => void; }; //# sourceMappingURL=internal.d.ts.map