move electron renderer messaging service to jslib

This commit is contained in:
Kyle Spearrin 2018-04-25 09:01:04 -04:00
parent 06c07ad4ea
commit e38fbfc3dd
4 changed files with 4 additions and 27 deletions

2
jslib

@ -1 +1 @@
Subproject commit 0ad2c9d6676783f2cd68a27733c3823eafc6d65b
Subproject commit 31bd1f9423f71ed749d27f9500eb88d272f112d1

View File

@ -7,11 +7,11 @@ import { ToasterModule } from 'angular2-toaster';
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
import { ElectronPlatformUtilsService } from 'jslib/electron/services/electronPlatformUtils.service';
import { ElectronRendererMessagingService } from 'jslib/electron/services/electronRendererMessaging.service';
import { ElectronRendererSecureStorageService } from 'jslib/electron/services/electronRendererSecureStorage.service';
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
import { isDev } from 'jslib/electron/utils';
import { DesktopRendererMessagingService } from '../services/desktopRendererMessaging.service';
import { I18nService } from '../services/i18n.service';
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
@ -72,7 +72,7 @@ const i18nService = new I18nService(window.navigator.language, './locales');
const stateService = new StateService();
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, true);
const broadcasterService = new BroadcasterService();
const messagingService = new DesktopRendererMessagingService(broadcasterService);
const messagingService = new ElectronRendererMessagingService(broadcasterService);
const storageService: StorageServiceAbstraction = new ElectronStorageService();
const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService();
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,

View File

@ -1,21 +0,0 @@
import { ipcRenderer } from 'electron';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
export class DesktopRendererMessagingService implements MessagingService {
constructor(private broadcasterService: BroadcasterService) {
ipcRenderer.on('messagingService', async (event: any, message: any) => {
if (message.command) {
this.send(message.command, message);
}
});
}
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
ipcRenderer.send('messagingService', message);
this.broadcasterService.send(message);
}
}

View File

@ -8,9 +8,7 @@
"target": "ES2016",
"allowJs": true,
"sourceMap": true,
"types": [
"node"
],
"types": [],
"baseUrl": ".",
"paths": {
"jslib/*": [ "jslib/src/*" ],