Back to Firebase Js Sdk

LoadBundleTask class

docs-devsite/firestore_.loadbundletask.md

12.12.13.7 KB
Original Source

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<LoadBundleTaskProgress><!-- -->.

<b>Signature:</b>

typescript
export declare class LoadBundleTask implements PromiseLike<LoadBundleTaskProgress> 

<b>Implements:</b> PromiseLike<LoadBundleTaskProgress<!-- -->>

Methods

MethodModifiersDescription
catch(onRejected)Implements the <code>Promise<LoadBundleTaskProgress>.catch</code> interface.
onProgress(next, error, complete)Registers functions to listen to bundle loading progress events.
then(onFulfilled, onRejected)Implements the <code>Promise<LoadBundleTaskProgress>.then</code> interface.

LoadBundleTask.catch()

Implements the Promise<LoadBundleTaskProgress>.catch interface.

<b>Signature:</b>

typescript
catch<R>(onRejected: (a: Error) => R | PromiseLike<R>): Promise<R | LoadBundleTaskProgress>;

Parameters

ParameterTypeDescription
onRejected(a: Error) => R | PromiseLike<R>Called when an error occurs during bundle loading.

<b>Returns:</b>

Promise<R | LoadBundleTaskProgress<!-- -->>

LoadBundleTask.onProgress()

Registers functions to listen to bundle loading progress events.

<b>Signature:</b>

typescript
onProgress(next?: (progress: LoadBundleTaskProgress) => unknown, error?: (err: Error) => unknown, complete?: () => void): void;

Parameters

ParameterTypeDescription
next(progress: LoadBundleTaskProgress<!-- -->) => unknownCalled when there is a progress update from bundle loading. Typically <code>next</code> calls occur each time a Firestore document is loaded from the bundle.
error(err: Error) => unknownCalled when an error occurs during bundle loading. The task aborts after reporting the error, and there should be no more updates after this.
complete() => voidCalled when the loading task is complete.

<b>Returns:</b>

void

LoadBundleTask.then()

Implements the Promise<LoadBundleTaskProgress>.then interface.

<b>Signature:</b>

typescript
then<T, R>(onFulfilled?: (a: LoadBundleTaskProgress) => T | PromiseLike<T>, onRejected?: (a: Error) => R | PromiseLike<R>): Promise<T | R>;

Parameters

ParameterTypeDescription
onFulfilled(a: LoadBundleTaskProgress<!-- -->) => T | PromiseLike<T>Called on the completion of the loading task with a final <code>LoadBundleTaskProgress</code> update. The update will always have its <code>taskState</code> set to <code>"Success"</code>.
onRejected(a: Error) => R | PromiseLike<R>Called when an error occurs during bundle loading.

<b>Returns:</b>

Promise<T | R>