Skip to content

Commit 9c34e5e

Browse files
dplewisTomWFox
authored andcommitted
Documentation for isDataAvailable (#647)
* Documentation for isDataAvailable * fix syntax
1 parent 6ac6542 commit 9c34e5e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

_includes/js/objects.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ myObject.fetch().then((myObject) => {
217217
});
218218
```
219219

220+
If you need to check if an object has been fetched, you can call the `isDataAvailable()` method:
221+
222+
```javascript
223+
if (!myObject.isDataAvailable()) {
224+
await myObject.fetch();
225+
}
226+
```
227+
220228
## Updating Objects
221229

222230
Updating an object is simple. Just set some new data on it and call the save method. For example:

_includes/php/objects.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ If you need to refresh an object you already have with the latest data that
8383
$gameScore->fetch();
8484
```
8585

86+
If you need to check if an object has been fetched, you can call the `isDataAvailable()` method:
87+
88+
```php
89+
if (!$gameScore->isDataAvailable()) {
90+
$gameScore->fetch();
91+
}
92+
```
93+
8694
## Updating Objects
8795

8896
Updating an object is simple. Just set some new data on it and call the save method. For example:

0 commit comments

Comments
 (0)