summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranonymous2022-09-21 12:46:08 -0400
committeranonymous2022-09-21 12:46:08 -0400
commita7491acf18c560646872efae2fac18c647e15cdd (patch)
tree753b23122c35acfe4708ef6b8e8b10897a1530a6
parent7c33c03c2613651b775218b363f38c3493006789 (diff)
delete->remove for js compatability
-rw-r--r--README.md8
-rw-r--r--src/socket.js10
2 files changed, 9 insertions, 9 deletions
diff --git a/README.md b/README.md
index c9ab192..03b98e6 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,8 @@ const queryID = await gs.subscribe({
}
// With an arbitrary update callback
(obj) => console.log(`An object has been created: {obj}`),
- // and delete callback
- (obj) => console.log(`An object with id {obj._id} by user {obj._by} has been deleted`.)
+ // and remove callback
+ (obj) => console.log(`An object with id {obj._id} by user {obj._by} has been removed.`)
)
// And then unsubscribe to those queries
@@ -52,6 +52,6 @@ await gs.update(myCoolPost)
myCoolPost.content += '!!!'
await gs.update(myCoolPost)
-// and delete objects.
-await gs.delete(myCoolPost)
+// and remove objects.
+await gs.remove(myCoolPost)
```
diff --git a/src/socket.js b/src/socket.js
index 1f762db..5c7760c 100644
--- a/src/socket.js
+++ b/src/socket.js
@@ -104,7 +104,7 @@ export default class {
if (data.type == 'updates') {
sd.updateCallback(r)
} else {
- sd.deleteCallback(r)
+ sd.removeCallback(r)
}
}
@@ -129,7 +129,7 @@ export default class {
return data.objectID
}
- async delete(objectID) {
+ async remove(objectID) {
await this.request({
type: "delete",
objectID
@@ -139,7 +139,7 @@ export default class {
async subscribe(
query,
updateCallback,
- deleteCallback,
+ removeCallback,
since=null,
queryID=null) {
@@ -154,7 +154,7 @@ export default class {
// Store the subscription in case of disconnections
this.subscriptionData[queryID] = {
- query, since, updateCallback, deleteCallback,
+ query, since, updateCallback, removeCallback,
historyComplete: false
}
@@ -182,7 +182,7 @@ export default class {
await this.subscribe(
sd.query,
sd.updateCallback,
- sd.deleteCallback,
+ sd.removeCallback,
sd.since,
queryID)
}