mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
move electron renderer messaging service to jslib
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 0ad2c9d667...31bd1f9423
@@ -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/*" ],
|
||||||
|
|||||||
Reference in New Issue
Block a user