Added config concept
This commit is contained in:
@@ -7,6 +7,7 @@ import { FileListService } from '../services/file-list-service';
|
||||
import { PrintService } from './../services/print-service';
|
||||
import { Logger } from '../utils/logger';
|
||||
import { DoorService } from '../services/door-service';
|
||||
import { readFile } from 'node:fs';
|
||||
|
||||
declare const global: Global;
|
||||
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
|
||||
@@ -18,8 +19,20 @@ export class Window {
|
||||
constructor() {
|
||||
this.createWindow();
|
||||
this.loadRenderer();
|
||||
this.registerService<void, any[]>(new FileListService());
|
||||
this.registerService<string, Door[]>(new DoorService());
|
||||
|
||||
const fileListService = new FileListService();
|
||||
this.registerService<void, any[]>(fileListService);
|
||||
this.registerService<any, Door[]>(new DoorService());
|
||||
|
||||
readFile('./config.json', 'utf8', (error, data) => {
|
||||
if(error){
|
||||
console.log(error);
|
||||
return;
|
||||
}
|
||||
const config = JSON.parse(data);
|
||||
fileListService.setPaths(config.filePaths);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private createWindow(): void {
|
||||
|
||||
Reference in New Issue
Block a user