Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference {% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %} # LoadBundleTask class Represents the task of loading a Firestore bundle. It provides progress of bundle loading, as well as task completion and error events. The API is compatible with `Promise`. Signature: ```typescript export declare class LoadBundleTask implements PromiseLike ``` Implements: PromiseLike<[LoadBundleTaskProgress](./firestore.loadbundletaskprogress.md#loadbundletaskprogress_interface)> ## Methods | Method | Modifiers | Description | | --- | --- | --- | | [catch(onRejected)](./firestore.loadbundletask.md#loadbundletaskcatch) | | Implements the Promise<LoadBundleTaskProgress>.catch interface. | | [onProgress(next, error, complete)](./firestore.loadbundletask.md#loadbundletaskonprogress) | | Registers functions to listen to bundle loading progress events. | | [then(onFulfilled, onRejected)](./firestore.loadbundletask.md#loadbundletaskthen) | | Implements the Promise<LoadBundleTaskProgress>.then interface. | ## LoadBundleTask.catch() Implements the `Promise.catch` interface. Signature: ```typescript catch( onRejected: (a: Error) => R | PromiseLike ): Promise; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | | onRejected | (a: Error) => R \| PromiseLike<R> | Called when an error occurs during bundle loading. | Returns: Promise<R \| [LoadBundleTaskProgress](./firestore.loadbundletaskprogress.md#loadbundletaskprogress_interface)> ## LoadBundleTask.onProgress() Registers functions to listen to bundle loading progress events. Signature: ```typescript onProgress( next?: (progress: LoadBundleTaskProgress) => unknown, error?: (err: Error) => unknown, complete?: () => void ): void; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | | next | (progress: [LoadBundleTaskProgress](./firestore.loadbundletaskprogress.md#loadbundletaskprogress_interface)) => unknown | Called when there is a progress update from bundle loading. Typically next calls occur each time a Firestore document is loaded from the bundle. | | error | (err: Error) => unknown | Called when an error occurs during bundle loading. The task aborts after reporting the error, and there should be no more updates after this. | | complete | () => void | Called when the loading task is complete. | Returns: void ## LoadBundleTask.then() Implements the `Promise.then` interface. Signature: ```typescript then( onFulfilled?: (a: LoadBundleTaskProgress) => T | PromiseLike, onRejected?: (a: Error) => R | PromiseLike ): Promise; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | | onFulfilled | (a: [LoadBundleTaskProgress](./firestore.loadbundletaskprogress.md#loadbundletaskprogress_interface)) => T \| PromiseLike<T> | Called on the completion of the loading task with a final LoadBundleTaskProgress update. The update will always have its taskState set to "Success". | | onRejected | (a: Error) => R \| PromiseLike<R> | Called when an error occurs during bundle loading. | Returns: Promise<T \| R>