UNPKG

@quartal/bridge-client

Version:

Universal client library for embedding applications with URL-configurable transport support (iframe, postMessage) and framework adapters for Angular and Vue

52 lines 1.68 kB
/** * Framework-agnostic iframe utilities for Quartal iframe integration * * These utilities help partners create and manage iframe elements * in any framework (Angular, Vue, React, vanilla JS, etc.) */ /** * Wait for an iframe element reference to be available * Useful when you have a template reference that might not be ready yet * * @param getElement - Function that returns the iframe element or null * @param options - Configuration options * @returns Promise that resolves to the iframe element * * @example * ```typescript * import { waitForIframeReference } from '@quartal/client'; * * // Angular example with ViewChild * @ViewChild('iframe') iframeRef!: ElementRef<HTMLIFrameElement>; * * async ngAfterViewInit() { * const iframe = await waitForIframeReference( * () => this.iframeRef?.nativeElement * ); * const client = parentClientManager.initializeParentClient({ * iframeElement: iframe, * debug: true * }); * } * * // Vue example with template ref * const iframeRef = ref<HTMLIFrameElement>(); * * onMounted(async () => { * const iframe = await waitForIframeReference( * () => iframeRef.value * ); * const client = parentClientManager.initializeParentClient({ * iframeElement: iframe, * debug: true * }); * }); * ``` */ export declare function waitForIframeReference(getElement: () => HTMLIFrameElement | null | undefined, options?: { /** Maximum time to wait in milliseconds (default: 5000) */ timeout?: number; /** Polling interval in milliseconds (default: 100) */ interval?: number; }): Promise<HTMLIFrameElement>; //# sourceMappingURL=iframe-helpers.d.ts.map