move electron renderer messaging service to jslib
This commit is contained in:
parent
06c07ad4ea
commit
e38fbfc3dd
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 0ad2c9d6676783f2cd68a27733c3823eafc6d65b
|
Subproject commit 31bd1f9423f71ed749d27f9500eb88d272f112d1
|
|
@ -7,11 +7,11 @@ import { ToasterModule } from 'angular2-toaster';
|
||||||
|
|
||||||
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
|
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
|
||||||
import { ElectronPlatformUtilsService } from 'jslib/electron/services/electronPlatformUtils.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 { ElectronRendererSecureStorageService } from 'jslib/electron/services/electronRendererSecureStorage.service';
|
||||||
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
|
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
|
||||||
import { isDev } from 'jslib/electron/utils';
|
import { isDev } from 'jslib/electron/utils';
|
||||||
|
|
||||||
import { DesktopRendererMessagingService } from '../services/desktopRendererMessaging.service';
|
|
||||||
import { I18nService } from '../services/i18n.service';
|
import { I18nService } from '../services/i18n.service';
|
||||||
|
|
||||||
import { AuthGuardService } from 'jslib/angular/services/auth-guard.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 stateService = new StateService();
|
||||||
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, true);
|
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, true);
|
||||||
const broadcasterService = new BroadcasterService();
|
const broadcasterService = new BroadcasterService();
|
||||||
const messagingService = new DesktopRendererMessagingService(broadcasterService);
|
const messagingService = new ElectronRendererMessagingService(broadcasterService);
|
||||||
const storageService: StorageServiceAbstraction = new ElectronStorageService();
|
const storageService: StorageServiceAbstraction = new ElectronStorageService();
|
||||||
const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService();
|
const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService();
|
||||||
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,
|
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,9 +8,7 @@
|
||||||
"target": "ES2016",
|
"target": "ES2016",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"types": [
|
"types": [],
|
||||||
"node"
|
|
||||||
],
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"jslib/*": [ "jslib/src/*" ],
|
"jslib/*": [ "jslib/src/*" ],
|
||||||
|
|
Loading…
Reference in New Issue