Skip to content

Commit 91e2b4e

Browse files
committed
Documented Offline methods
1 parent 8394be0 commit 91e2b4e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,23 @@ Firestack attempts to provide the same API as the JS Firebase library for both A
594594

595595
// TODO: Finish documenting
596596

597+
#### Offline data persistence
598+
599+
For handling offline operations, you can enable persistence by using the `setPersistence()` command. You can turn it on and off by passing the boolean of `true` or `false`.
600+
601+
```javascript
602+
firestack.database.setPersistence(true);
603+
```
604+
605+
The database refs has a `keepSynced()` function to tell the firestack library to keep the data at the `ref` in sync.
606+
607+
```javascript
608+
const ref = firestack.database
609+
.ref('chat-messages')
610+
.child('roomId');
611+
ref.keepSynced(true);
612+
```
613+
597614
### Presence
598615

599616
Firestack comes in with a built-in method for handling user connections. We just need to set the presence ref url and tell Firestack to keep track of the user by their child path.

0 commit comments

Comments
 (0)