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

Commit

Permalink
main messaging service to jslib
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Apr 26, 2018
1 parent 983a7b4 commit 35039fd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/electron/services/electronMainMessaging.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MessagingService } from '../../abstractions/messaging.service';

import { WindowMain } from '../window.main';

export class ElectronMainMessagingService implements MessagingService {
constructor(private windowMain: WindowMain, private onMessage: (message: any) => void) { }

send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
this.onMessage(message);
if (this.windowMain.win != null) {
this.windowMain.win.webContents.send('messagingService', message);
}
}
}

0 comments on commit 35039fd

Please sign in to comment.