You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -594,6 +594,23 @@ Firestack attempts to provide the same API as the JS Firebase library for both A
594
594
595
595
// TODO: Finish documenting
596
596
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
+
constref=firestack.database
609
+
.ref('chat-messages')
610
+
.child('roomId');
611
+
ref.keepSynced(true);
612
+
```
613
+
597
614
### Presence
598
615
599
616
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