feat(desktop): support multiple windows

Closes #250
This commit is contained in:
Arielle Ostankova
2026-06-05 21:08:24 +08:00
committed by GitHub
parent 1377adbece
commit df635b570a
12 changed files with 362 additions and 62 deletions
@@ -0,0 +1,32 @@
export class PendingOpenProjectStore {
private readonly pendingPathByWebContentsId = new Map<number, string>();
set(webContentsId: number, projectPath: string | null | undefined): void {
const normalizedPath = this.normalizeProjectPath(projectPath);
if (!normalizedPath) {
this.pendingPathByWebContentsId.delete(webContentsId);
return;
}
this.pendingPathByWebContentsId.set(webContentsId, normalizedPath);
}
take(webContentsId: number): string | null {
const projectPath = this.pendingPathByWebContentsId.get(webContentsId) ?? null;
this.pendingPathByWebContentsId.delete(webContentsId);
return projectPath;
}
delete(webContentsId: number): void {
this.pendingPathByWebContentsId.delete(webContentsId);
}
private normalizeProjectPath(projectPath: string | null | undefined): string | null {
if (typeof projectPath !== "string") {
return null;
}
const trimmedPath = projectPath.trim();
return trimmedPath ? trimmedPath : null;
}
}