Add LiveQuery

This commit is contained in:
wangmengyan95
2016-03-10 14:27:00 -08:00
parent cf3606246f
commit 555e25bf33
33 changed files with 3580 additions and 48 deletions

View File

@@ -0,0 +1,29 @@
import { RedisPubSub } from './RedisPubSub';
import { EventEmitterPubSub } from './EventEmitterPubSub';
let ParsePubSub = {};
function useRedis(config: any): boolean {
let redisURL = config.redisURL;
return typeof redisURL !== 'undefined' && redisURL !== '';
}
ParsePubSub.createPublisher = function(config: any): any {
if (useRedis(config)) {
return RedisPubSub.createPublisher(config.redisURL);
} else {
return EventEmitterPubSub.createPublisher();
}
}
ParsePubSub.createSubscriber = function(config: any): void {
if (useRedis(config)) {
return RedisPubSub.createSubscriber(config.redisURL);
} else {
return EventEmitterPubSub.createSubscriber();
}
}
export {
ParsePubSub
}