Skip to content

Commit 0ae3b3d

Browse files
committed
change to watch
1 parent 429e411 commit 0ae3b3d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

spec/ParseLiveQuery.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ describe('ParseLiveQuery', function () {
402402
startLiveQueryServer: true,
403403
});
404404
const query = new Parse.Query('Test');
405-
query.listen('yolo');
405+
query.watch('yolo');
406406
const subscription = await query.subscribe();
407407
const spy = {
408408
create(obj) {

spec/ParseLiveQueryServer.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ describe('ParseLiveQueryServer', function () {
10871087
done();
10881088
});
10891089

1090-
it('can handle create command with listen', async () => {
1090+
it('can handle create command with watch', async () => {
10911091
jasmine.restoreLibrary('../lib/LiveQuery/Client', 'Client');
10921092
const Client = require('../lib/LiveQuery/Client').Client;
10931093
const parseLiveQueryServer = new ParseLiveQueryServer({});
@@ -1110,7 +1110,7 @@ describe('ParseLiveQueryServer', function () {
11101110
where: {
11111111
key: 'value',
11121112
},
1113-
listen: ['yolo'],
1113+
watch: ['yolo'],
11141114
};
11151115
await addMockSubscription(parseLiveQueryServer, clientId, requestId, parseWebSocket, query);
11161116
// Mock _matchesSubscription to return matching

src/LiveQuery/ParseLiveQueryServer.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ class ParseLiveQueryServer {
330330
} else {
331331
return null;
332332
}
333-
const listenFieldsChanged = this._checkListenFields(client, requestId, message);
334-
if (!listenFieldsChanged && (type === 'update' || type === 'create')) {
333+
const watchFieldsChanged = this._checkWatchFields(client, requestId, message);
334+
if (!watchFieldsChanged && (type === 'update' || type === 'create')) {
335335
return;
336336
}
337337
res = {
@@ -712,15 +712,15 @@ class ParseLiveQueryServer {
712712
return auth;
713713
}
714714

715-
_checkListenFields(client: any, requestId: any, message: any) {
715+
_checkWatchFields(client: any, requestId: any, message: any) {
716716
const subscriptionInfo = client.getSubscriptionInfo(requestId);
717-
const listen = subscriptionInfo?.listen;
718-
if (!listen) {
717+
const watch = subscriptionInfo?.watch;
718+
if (!watch) {
719719
return true;
720720
}
721721
const object = message.currentParseObject;
722722
const original = message.originalParseObject;
723-
return listen.some(field => !isDeepStrictEqual(object.get(field), original?.get(field)));
723+
return watch.some(field => !isDeepStrictEqual(object.get(field), original?.get(field)));
724724
}
725725

726726
async _matchesACL(acl: any, client: any, requestId: number): Promise<boolean> {
@@ -904,8 +904,8 @@ class ParseLiveQueryServer {
904904
if (request.query.fields) {
905905
subscriptionInfo.fields = request.query.fields;
906906
}
907-
if (request.query.listen) {
908-
subscriptionInfo.listen = request.query.listen;
907+
if (request.query.watch) {
908+
subscriptionInfo.watch = request.query.watch;
909909
}
910910
if (request.sessionToken) {
911911
subscriptionInfo.sessionToken = request.sessionToken;

0 commit comments

Comments
 (0)