UNPKG

@birdie-so/snippet

Version:

Helper for integrating the Birdie screen recording snippet into modern JavaScript apps. Requires a Birdie account.

38 lines (31 loc) 1.05 kB
export interface BirdieMetadata { [key: string]: any; } export interface BirdieSettings { /** * Unique Birdie client ID. */ clientId: string; /** * Optional metadata to pass to Birdie before recording starts. */ metadata?: BirdieMetadata; /** * Callback when Birdie is fully loaded and available as `window.birdie`. */ onReady?: (birdie: BirdieAPI) => void; } export interface BirdieAPI { metadata: BirdieMetadata; on(event: 'start' | 'stop', callback: (data: any) => void): void; } /** * Initializes the Birdie widget by injecting the CDN script with your client ID. * Automatically configures window.birdieSettings and registers optional metadata or event listeners. */ export function initBirdie(settings: BirdieSettings): void; /** * Returns the current `window.birdie` instance if available, or null. * You can also pass a callback to run once Birdie becomes available. */ export function getBirdieInstance(callback?: (birdie: BirdieAPI) => void): BirdieAPI | null;