From caeba1197c4b66e10614ffbddce0a2e98b0b5ef3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 24 May 2017 20:50:17 +0900 Subject: Refactoring --- src/api/event.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/api/event.ts') diff --git a/src/api/event.ts b/src/api/event.ts index 39dc809bdc..9613a9f7cc 100644 --- a/src/api/event.ts +++ b/src/api/event.ts @@ -13,14 +13,6 @@ class MisskeyEvent { config.redis.port, config.redis.host); } - private publish(channel: string, type: string, value?: any): void { - const message = value == null ? - { type: type } : - { type: type, body: value }; - - this.redisClient.publish(`misskey:${channel}`, JSON.stringify(message)); - } - public publishUserStream(userId: ID, type: string, value?: any): void { this.publish(`user-stream:${userId}`, type, typeof value === 'undefined' ? null : value); } @@ -32,6 +24,14 @@ class MisskeyEvent { public publishMessagingStream(userId: ID, otherpartyId: ID, type: string, value?: any): void { this.publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value); } + + private publish(channel: string, type: string, value?: any): void { + const message = value == null ? + { type: type } : + { type: type, body: value }; + + this.redisClient.publish(`misskey:${channel}`, JSON.stringify(message)); + } } const ev = new MisskeyEvent(); -- cgit v1.2.3-freya