Skip to content

Commit 8aa2c87

Browse files
authored
docs: add section for saving objects offline (#905)
1 parent 3056a56 commit 8aa2c87

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

_includes/js/objects.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ teamMember.save(null, { cascadeSave: false });
205205

206206
```
207207

208+
### Saving Objects Offline
209+
210+
Most save functions execute immediately, and inform your app when the save is complete. If you don’t need to know when the save has finished, you can use `saveEventually` instead. The advantage is that if the user currently doesn’t have a network connection, `saveEventually` will store the update on the device until a network connection is re-established. If your app is closed before the connection is back, Parse will try again the next time the app is opened. All calls to `saveEventually` (and `destroyEventually`) are executed in the order they are called, so it is safe to call `saveEventually` on an object multiple times. If you have the local datastore enabled, then any object you saveEventually will be pinned as long as that save is in progress. That makes it easy to retrieve your local changes while waiting for the network to be available. `Parse.enableLocalDatastore()` must be called to use this feature.
211+
212+
```javascript
213+
const TeamMember = Parse.Object.extend("TeamMember");
214+
const teamMember = new TeamMember();
215+
216+
teamMember.set('ownerAccount', ownerAccount);
217+
218+
await teamMember.saveEventually();
219+
```
220+
208221
### Cloud Code context
209222

210223
*Requires Parse Server 4.3.0+*

assets/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)