Skip to content

Commit 537d399

Browse files
authored
Update the JSDoc for enableIndexedDbPersistence (#7852)
1 parent f478845 commit 537d399

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

docs-devsite/firestore_.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ https://github.com/firebase/firebase-js-sdk
2626
| [connectFirestoreEmulator(firestore, host, port, options)](./firestore_.md#connectfirestoreemulator_7c247cd) | Modify this instance to communicate with the Cloud Firestore emulator.<!-- -->Note: This must be called before this instance has been used to do any operations. |
2727
| [disableNetwork(firestore)](./firestore_.md#disablenetwork_231a8e0) | Disables network usage for this instance. It can be re-enabled via [enableNetwork()](./firestore_.md#enablenetwork_231a8e0)<!-- -->. While the network is disabled, any snapshot listeners, <code>getDoc()</code> or <code>getDocs()</code> calls will return results from cache, and any write operations will be queued until the network is restored. |
2828
| [doc(firestore, path, pathSegments)](./firestore_.md#doc_1eb4c23) | Gets a <code>DocumentReference</code> instance that refers to the document at the specified absolute path. |
29-
| [enableIndexedDbPersistence(firestore, persistenceSettings)](./firestore_.md#enableindexeddbpersistence_224174f) | Attempts to enable persistent storage, if possible.<!-- -->Must be called before any other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore_fc7d200)<!-- -->, [getFirestore()](./firestore_.md#getfirestore) or [clearIndexedDbPersistence()](./firestore_.md#clearindexeddbpersistence_231a8e0)<!-- -->.<!-- -->If this fails, <code>enableIndexedDbPersistence()</code> will reject the promise it returns. Note that even after this failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.<!-- -->There are several reasons why this can fail, which can be identified by the <code>code</code> on the error.<!-- -->\* failed-precondition: The app is already open in another browser tab. \* unimplemented: The browser is incompatible with the offline persistence implementation.<!-- -->Persistence cannot be used in a Node.js environment. |
30-
| [enableMultiTabIndexedDbPersistence(firestore)](./firestore_.md#enablemultitabindexeddbpersistence_231a8e0) | Attempts to enable multi-tab persistent storage, if possible. If enabled across all tabs, all operations share access to local persistence, including shared execution of queries and latency-compensated local document updates across all connected instances.<!-- -->If this fails, <code>enableMultiTabIndexedDbPersistence()</code> will reject the promise it returns. Note that even after this failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.<!-- -->There are several reasons why this can fail, which can be identified by the <code>code</code> on the error.<!-- -->\* failed-precondition: The app is already open in another browser tab and multi-tab is not enabled. \* unimplemented: The browser is incompatible with the offline persistence implementation. |
29+
| [enableIndexedDbPersistence(firestore, persistenceSettings)](./firestore_.md#enableindexeddbpersistence_224174f) | Attempts to enable persistent storage, if possible.<!-- -->On failure, <code>enableIndexedDbPersistence()</code> will reject the promise or throw an exception. There are several reasons why this can fail, which can be identified by the <code>code</code> on the error.<!-- -->\* failed-precondition: The app is already open in another browser tab. \* unimplemented: The browser is incompatible with the offline persistence implementation.<!-- -->Note that even after a failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.<!-- -->Note: <code>enableIndexedDbPersistence()</code> must be called before any other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore_fc7d200)<!-- -->, [getFirestore()](./firestore_.md#getfirestore) or [clearIndexedDbPersistence()](./firestore_.md#clearindexeddbpersistence_231a8e0)<!-- -->.<!-- -->Persistence cannot be used in a Node.js environment. |
30+
| [enableMultiTabIndexedDbPersistence(firestore)](./firestore_.md#enablemultitabindexeddbpersistence_231a8e0) | Attempts to enable multi-tab persistent storage, if possible. If enabled across all tabs, all operations share access to local persistence, including shared execution of queries and latency-compensated local document updates across all connected instances.<!-- -->On failure, <code>enableMultiTabIndexedDbPersistence()</code> will reject the promise or throw an exception. There are several reasons why this can fail, which can be identified by the <code>code</code> on the error.<!-- -->\* failed-precondition: The app is already open in another browser tab and multi-tab is not enabled. \* unimplemented: The browser is incompatible with the offline persistence implementation.<!-- -->Note that even after a failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled. |
3131
| [enableNetwork(firestore)](./firestore_.md#enablenetwork_231a8e0) | Re-enables use of the network for this [Firestore](./firestore_.firestore.md#firestore_class) instance after a prior call to [disableNetwork()](./firestore_.md#disablenetwork_231a8e0)<!-- -->. |
3232
| [getPersistentCacheIndexManager(firestore)](./firestore_.md#getpersistentcacheindexmanager_231a8e0) | Returns the PersistentCache Index Manager used by the given <code>Firestore</code> object. The <code>PersistentCacheIndexManager</code> instance, or <code>null</code> if local persistent storage is not in use. |
3333
| [loadBundle(firestore, bundleData)](./firestore_.md#loadbundle_bec5b75) | Loads a Firestore bundle into the local cache. |
@@ -459,13 +459,13 @@ If the final path has an odd number of segments and does not point to a document
459459
460460
Attempts to enable persistent storage, if possible.
461461

462-
Must be called before any other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore_fc7d200)<!-- -->, [getFirestore()](./firestore_.md#getfirestore) or [clearIndexedDbPersistence()](./firestore_.md#clearindexeddbpersistence_231a8e0)<!-- -->.
462+
On failure, `enableIndexedDbPersistence()` will reject the promise or throw an exception. There are several reasons why this can fail, which can be identified by the `code` on the error.
463463

464-
If this fails, `enableIndexedDbPersistence()` will reject the promise it returns. Note that even after this failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.
464+
\* failed-precondition: The app is already open in another browser tab. \* unimplemented: The browser is incompatible with the offline persistence implementation.
465465

466-
There are several reasons why this can fail, which can be identified by the `code` on the error.
466+
Note that even after a failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.
467467

468-
\* failed-precondition: The app is already open in another browser tab. \* unimplemented: The browser is incompatible with the offline persistence implementation.
468+
Note: `enableIndexedDbPersistence()` must be called before any other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore_fc7d200)<!-- -->, [getFirestore()](./firestore_.md#getfirestore) or [clearIndexedDbPersistence()](./firestore_.md#clearindexeddbpersistence_231a8e0)<!-- -->.
469469

470470
Persistence cannot be used in a Node.js environment.
471471

@@ -497,12 +497,12 @@ A `Promise` that represents successfully enabling persistent storage.
497497
498498
Attempts to enable multi-tab persistent storage, if possible. If enabled across all tabs, all operations share access to local persistence, including shared execution of queries and latency-compensated local document updates across all connected instances.
499499

500-
If this fails, `enableMultiTabIndexedDbPersistence()` will reject the promise it returns. Note that even after this failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.
501-
502-
There are several reasons why this can fail, which can be identified by the `code` on the error.
500+
On failure, `enableMultiTabIndexedDbPersistence()` will reject the promise or throw an exception. There are several reasons why this can fail, which can be identified by the `code` on the error.
503501

504502
\* failed-precondition: The app is already open in another browser tab and multi-tab is not enabled. \* unimplemented: The browser is incompatible with the offline persistence implementation.
505503

504+
Note that even after a failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.
505+
506506
<b>Signature:</b>
507507

508508
```typescript

packages/firestore/src/api/database.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -305,20 +305,20 @@ export function configureFirestore(firestore: Firestore): void {
305305
/**
306306
* Attempts to enable persistent storage, if possible.
307307
*
308-
* Must be called before any other functions (other than
309-
* {@link initializeFirestore}, {@link (getFirestore:1)} or
310-
* {@link clearIndexedDbPersistence}.
308+
* On failure, `enableIndexedDbPersistence()` will reject the promise or
309+
* throw an exception. There are several reasons why this can fail, which can be
310+
* identified by the `code` on the error.
311311
*
312-
* If this fails, `enableIndexedDbPersistence()` will reject the promise it
313-
* returns. Note that even after this failure, the {@link Firestore} instance will
314-
* remain usable, however offline persistence will be disabled.
312+
* * failed-precondition: The app is already open in another browser tab.
313+
* * unimplemented: The browser is incompatible with the offline persistence
314+
* implementation.
315315
*
316-
* There are several reasons why this can fail, which can be identified by
317-
* the `code` on the error.
316+
* Note that even after a failure, the {@link Firestore} instance will remain
317+
* usable, however offline persistence will be disabled.
318318
*
319-
* * failed-precondition: The app is already open in another browser tab.
320-
* * unimplemented: The browser is incompatible with the offline
321-
* persistence implementation.
319+
* Note: `enableIndexedDbPersistence()` must be called before any other functions
320+
* (other than {@link initializeFirestore}, {@link (getFirestore:1)} or
321+
* {@link clearIndexedDbPersistence}.
322322
*
323323
* Persistence cannot be used in a Node.js environment.
324324
*
@@ -371,17 +371,17 @@ export function enableIndexedDbPersistence(
371371
* shared execution of queries and latency-compensated local document updates
372372
* across all connected instances.
373373
*
374-
* If this fails, `enableMultiTabIndexedDbPersistence()` will reject the promise
375-
* it returns. Note that even after this failure, the {@link Firestore} instance will
376-
* remain usable, however offline persistence will be disabled.
377-
*
378-
* There are several reasons why this can fail, which can be identified by
379-
* the `code` on the error.
374+
* On failure, `enableMultiTabIndexedDbPersistence()` will reject the promise or
375+
* throw an exception. There are several reasons why this can fail, which can be
376+
* identified by the `code` on the error.
380377
*
381378
* * failed-precondition: The app is already open in another browser tab and
382379
* multi-tab is not enabled.
383-
* * unimplemented: The browser is incompatible with the offline
384-
* persistence implementation.
380+
* * unimplemented: The browser is incompatible with the offline persistence
381+
* implementation.
382+
*
383+
* Note that even after a failure, the {@link Firestore} instance will remain
384+
* usable, however offline persistence will be disabled.
385385
*
386386
* @param firestore - The {@link Firestore} instance to enable persistence for.
387387
* @returns A `Promise` that represents successfully enabling persistent

0 commit comments

Comments
 (0)