bitwarden-desktop/src/main.ts

32 lines
888 B
TypeScript
Raw Normal View History

2018-02-08 19:10:13 +01:00
import { BrowserWindow } from 'electron';
2018-01-16 21:58:17 +01:00
2018-02-08 19:10:13 +01:00
import { MenuMain } from './main/menu.main';
import { MessagingMain } from './main/messaging.main';
import { WindowMain } from './main/window.main';
2018-01-23 19:59:01 +01:00
2018-01-24 22:02:18 +01:00
import { I18nService } from './services/i18n.service';
2018-02-08 18:24:17 +01:00
2018-01-16 23:30:57 +01:00
const args = process.argv.slice(1);
2018-01-17 21:42:28 +01:00
const watch = args.some((val) => val === '--watch');
const dev = args.some((val) => val === '--dev');
2018-01-16 20:48:34 +01:00
2018-01-17 21:42:28 +01:00
if (watch) {
2018-02-10 21:30:42 +01:00
// tslint:disable-next-line
2018-01-16 23:30:57 +01:00
require('electron-reload')(__dirname, {});
}
2018-02-08 19:10:13 +01:00
const i18nService = new I18nService('en', './locales/');
2018-02-08 21:58:47 +01:00
const windowMain = new WindowMain(dev);
2018-02-09 21:49:00 +01:00
const messagingMain = new MessagingMain(windowMain);
2018-02-09 06:21:00 +01:00
const menuMain = new MenuMain(windowMain, i18nService);
2018-01-16 23:30:57 +01:00
2018-02-10 17:58:14 +01:00
windowMain.init().then(() => {
messagingMain.init();
return i18nService.init();
}).then(() => {
2018-02-09 06:21:00 +01:00
menuMain.init();
}, (e: any) => {
2018-02-10 21:30:42 +01:00
// tslint:disable-next-line
2018-02-09 06:21:00 +01:00
console.log(e);
});