From e7779759f25d315d35b20ae85371ebe86fed3eef Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 8 May 2018 10:29:19 -0400 Subject: [PATCH] dont send message back to main if that's where it came from originally --- .../services/electronRendererMessaging.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/electron/services/electronRendererMessaging.service.ts b/src/electron/services/electronRendererMessaging.service.ts index 9dedd360a7..b967b4e530 100644 --- a/src/electron/services/electronRendererMessaging.service.ts +++ b/src/electron/services/electronRendererMessaging.service.ts @@ -8,14 +8,20 @@ export class ElectronRendererMessagingService implements MessagingService { constructor(private broadcasterService: BroadcasterService) { ipcRenderer.on('messagingService', async (event: any, message: any) => { if (message.command) { - this.send(message.command, message); + this.sendMessage(message.command, message, false); } }); } send(subscriber: string, arg: any = {}) { + this.sendMessage(subscriber, arg, true); + } + + private sendMessage(subscriber: string, arg: any = {}, toMain: boolean) { const message = Object.assign({}, { command: subscriber }, arg); - ipcRenderer.send('messagingService', message); this.broadcasterService.send(message); + if (toMain) { + ipcRenderer.send('messagingService', message); + } } }