refactor: cleanup initIPCHandlers

This commit is contained in:
tiddlygit-test 2021-02-06 23:15:12 +08:00
parent 5a94266d3a
commit 762e1bb596
7 changed files with 32 additions and 78 deletions

View file

@ -27,28 +27,9 @@ export class WorkspaceView implements IWorkspaceViewService {
@inject(serviceIdentifier.Preference) private readonly preferenceService: IPreferenceService,
@inject(serviceIdentifier.MenuService) private readonly menuService: IMenuService,
) {
this.initIPCHandlers();
this.registerMenu();
}
private initIPCHandlers(): void {
ipcMain.handle('request-set-active-workspace', async (_event, id) => {
if (this.workspaceService.get(id) !== undefined) {
await this.setActiveWorkspaceView(id);
this.menuService.buildMenu();
}
});
ipcMain.handle('request-set-workspace', async (_event, id, options) => {
await this.setWorkspaceView(id, options);
this.menuService.buildMenu();
});
ipcMain.handle('request-set-workspaces', async (_event, workspaces) => {
await this.setWorkspaceViews(workspaces);
this.menuService.buildMenu();
});
}
/**
* Prepare workspaces on startup
*/