Skip to content

Commit 7a49ca7

Browse files
committed
Live Query Support.
1 parent c5611a5 commit 7a49ca7

File tree

8 files changed

+1162
-0
lines changed

8 files changed

+1162
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"dependencies": {
3131
"babel-runtime": "^5.8.20",
32+
"ws": "^1.0.1",
3233
"xmlhttprequest": "^1.7.0"
3334
},
3435
"devDependencies": {

src/CoreManager.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ var config: { [key: string]: mixed } = {
117117
!process.version.electron),
118118
REQUEST_ATTEMPT_LIMIT: 5,
119119
SERVER_URL: 'https://api.parse.com/1',
120+
LIVEQUERY_SERVER_URL: null,
120121
VERSION: 'js' + require('../package.json').version,
121122
APPLICATION_ID: null,
122123
JAVASCRIPT_KEY: null,
@@ -455,5 +456,25 @@ module.exports = {
455456

456457
getUserController(): UserController {
457458
return config['UserController'];
459+
},
460+
461+
setLiveQueryController(controller: any) {
462+
if (typeof controller.subscribe !== 'function') {
463+
throw new Error('LiveQueryController must implement subscribe()');
464+
}
465+
if (typeof controller.unsubscribe !== 'function') {
466+
throw new Error('LiveQueryController must implement unsubscribe()');
467+
}
468+
if (typeof controller.open !== 'function') {
469+
throw new Error('LiveQueryController must implement open()');
470+
}
471+
if (typeof controller.close !== 'function') {
472+
throw new Error('LiveQueryController must implement close()');
473+
}
474+
config['LiveQueryController'] = controller;
475+
},
476+
477+
getLiveQueryController(): any {
478+
return config['LiveQueryController'];
458479
}
459480
}

0 commit comments

Comments
 (0)