aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/index.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-27 19:41:46 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-27 19:51:14 +0100
commitf5f27eddc93314e8e10ab96c7bdb5c626142a1d3 (patch)
tree99ce5eca8c2bf3590612b24e33d4fe727bd240ab /packages/main/src/index.ts
parentfix: Allow the shared store listener to re-register in dev mode (diff)
downloadsophie-f5f27eddc93314e8e10ab96c7bdb5c626142a1d3.tar.gz
sophie-f5f27eddc93314e8e10ab96c7bdb5c626142a1d3.tar.zst
sophie-f5f27eddc93314e8e10ab96c7bdb5c626142a1d3.zip
refactor: Inversion of control with typed-inject
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r--packages/main/src/index.ts15
1 files changed, 5 insertions, 10 deletions
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts
index 7aa3ee9..8eb0803 100644
--- a/packages/main/src/index.ts
+++ b/packages/main/src/index.ts
@@ -45,10 +45,7 @@ import {
45 installDevToolsExtensions, 45 installDevToolsExtensions,
46 openDevToolsWhenReady, 46 openDevToolsWhenReady,
47} from './devTools'; 47} from './devTools';
48import { initConfig } from './controllers/ConfigController'; 48import { injector } from './injector';
49import { initNativeTheme } from './controllers/NativeThemeController';
50import { ConfigPersistenceService } from './services/ConfigPersistenceService';
51import { NativeThemeService } from './services/NativeThemeService';
52import { createMainStore } from './stores/MainStore'; 49import { createMainStore } from './stores/MainStore';
53 50
54const isDevelopment = import.meta.env.MODE === 'development'; 51const isDevelopment = import.meta.env.MODE === 'development';
@@ -108,12 +105,10 @@ let mainWindow: BrowserWindow | null = null;
108 105
109const store = createMainStore(); 106const store = createMainStore();
110 107
111initConfig( 108const controller = injector.resolve('mainController');
112 store.config, 109controller.connect(store).catch((err) => {
113 new ConfigPersistenceService(app.getPath('userData'), 'config.json5'), 110 console.log('Error while initializing app', err);
114).then(() => { 111});
115 initNativeTheme(store, new NativeThemeService());
116}).catch((err) => console.error(err));
117 112
118const rendererBaseUrl = getResourceUrl('../renderer/'); 113const rendererBaseUrl = getResourceUrl('../renderer/');
119function shouldCancelMainWindowRequest(url: string, method: string): boolean { 114function shouldCancelMainWindowRequest(url: string, method: string): boolean {