UNPKG

vue3-ytframe

Version:
26 lines (25 loc) 1.13 kB
/** Dev-only diagnostic; the published library stays silent in production. */ export declare function warn(...args: unknown[]): void; /** * A debounced version of `fn` that delays invocation until `wait` ms have * elapsed since the last call. The returned function keeps a single shared * timer across calls (so rapid calls genuinely coalesce) and exposes * `cancel()` to clear a pending invocation — used on component teardown. */ export declare function debounce<A extends unknown[]>(fn: (...args: A) => void, wait: number): ((...args: A) => void) & { cancel: () => void; }; /** * Extracts the 11-character video ID from a YouTube URL, or returns `null` * when the input is not a recognizable YouTube URL. * * Supported forms (http or https, optional `www.`/`m.`): * - `youtube.com/watch?v=<id>` (the `v` param may appear in any position) * - `youtu.be/<id>` * - `youtube.com/embed/<id>` * - `youtube.com/shorts/<id>` * - `youtube.com/live/<id>` * - `youtube.com/v/<id>` * - `youtube-nocookie.com/embed/<id>` */ export declare function getVideoIdFromYoutubeURL(url: string | null | undefined): string | null;