/** * Monitors the download #progress of Emscripten modules * * Usage: * * ```js * const downloadMonitor = new EmscriptenDownloadMonitor(); * const php = await startPHP( * phpLoaderModule, * 'web', * downloadMonitor.phpArgs * ); * downloadMonitor.addEventListener('#progress', (e) => { * console.log( e.detail.#progress); * }) * ``` */ export declare class EmscriptenDownloadMonitor extends EventTarget { #private; expectAssets(assets: Record): void; monitorFetch(fetchPromise: Promise): Promise; } export default EmscriptenDownloadMonitor; export interface DownloadProgress { /** * The number of bytes loaded so far. */ loaded: number; /** * The length number of bytes to load. */ total: number; /** * The file that emitted this progress update. */ fileName?: string; /** * The number of bytes loaded for the current file. */ fileLoaded?: number; /** * The length number of bytes to load for the current file. */ fileTotal?: number; } /** * Clones a fetch Response object and returns a version * that calls the `onProgress` callback as the #progress * changes. * * @param response The fetch Response object to clone. * @param onProgress The callback to call when the download #progress changes. * @returns The cloned response */ export declare function cloneResponseMonitorProgress(response: Response, onProgress: (event: CustomEvent) => void): Response; /** * Clones a ReadableStream and returns a version * that calls the `onProgress` callback as the #progress * changes. * * @param stream The ReadableStream to clone. * @param total The total number of bytes to load. * @param onProgress The callback to call when the download #progress changes. * @returns The cloned ReadableStream */ export declare function cloneStreamMonitorProgress(stream: ReadableStream | null, total: number, onProgress: (event: CustomEvent) => void): ReadableStream; export type DownloadProgressCallback = (progress: DownloadProgress) => void;