Skip to content

Commit

Permalink
refactor IPC handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Nov 7, 2024
1 parent 8b36251 commit 7b88178
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/handlers/ipcHandler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { PathHandlers } from './pathHandlers';

export class IPCHandler {
constructor() {}

registerHandlers() {
new PathHandlers().registerHandlers();
}
}
15 changes: 15 additions & 0 deletions src/handlers/pathHandlers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ipcMain } from 'electron';
import { IPC_CHANNELS } from '../constants';
import { determineResourcesPaths } from '../main';

export class PathHandlers {
constructor() {}

registerHandlers() {
// Path-related handlers
ipcMain.handle(IPC_CHANNELS.GET_BASE_PATH, async () => {
const { basePath } = await determineResourcesPaths();
return basePath;
});
}
}
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { ComfySettings } from './config/comfySettings';
import dotenv from 'dotenv';
import { buildMenu } from './menu/menu';
import { ComfyConfigManager } from './config/comfyConfigManager';
import { PathHandlers } from './handlers/pathHandlers';

dotenv.config();

Expand Down

0 comments on commit 7b88178

Please sign in to comment.