diff options
author | anonymous | 2022-09-21 12:46:08 -0400 |
---|---|---|
committer | anonymous | 2022-09-21 12:46:08 -0400 |
commit | a7491acf18c560646872efae2fac18c647e15cdd (patch) | |
tree | 753b23122c35acfe4708ef6b8e8b10897a1530a6 | |
parent | 7c33c03c2613651b775218b363f38c3493006789 (diff) |
delete->remove for js compatability
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | src/socket.js | 10 |
2 files changed, 9 insertions, 9 deletions
@@ -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) } |