Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
dont send message back to main if that's where it came from originally
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed May 8, 2018
1 parent 3270d8b commit e777975
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/electron/services/electronRendererMessaging.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit e777975

Please sign in to comment.