Skip to content

Commit

Permalink
Fix type error in document.subscribe('status') (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb authored Aug 16, 2024
1 parent b72ad6e commit e495750
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/js-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ For more information about `DocumentSyncStatus`, please refer to the [DocumentSy

##### Document.subscribe('status')

You can subscribe to the status of the document using `doc.subscribe('status', callback)`. The possible values for `event.value` are `DocumentStatus.Attached` and `DocumentStatus.Detached`.
You can subscribe to the status of the document using `doc.subscribe('status', callback)`. The possible values for `event.value.status` are `DocumentStatus.Attached` and `DocumentStatus.Detached`.

```javascript
const unsubscribe = doc.subscribe('status', (event) => {
if (event.value === DocumentStatus.Attached) {
if (event.value.status === DocumentStatus.Attached) {
// The document is attached to the client.
} else if (event.value === DocumentStatus.Detached) {
} else if (event.value.status === DocumentStatus.Detached) {
// The document is detached from the client.
}
});
Expand Down

0 comments on commit e495750

Please sign in to comment.