Files
spark-store/electron/main/window-close-guard.ts
momen 0b17ada45a feat(update-center): 实现集中式软件更新中心功能
新增更新中心模块,支持管理 APM 和传统 deb 软件更新任务
- 添加更新任务队列管理、状态跟踪和日志记录功能
- 实现更新项忽略配置持久化存储
- 新增更新确认对话框和迁移提示
- 优化主窗口关闭时的任务保护机制
- 添加单元测试覆盖核心逻辑
2026-04-09 08:19:51 +08:00

16 lines
501 B
TypeScript

export interface MainWindowCloseGuardState {
installTaskCount: number;
hasRunningUpdateCenterTasks: boolean;
}
export type MainWindowCloseAction = "hide" | "destroy";
export const shouldPreventMainWindowClose = (
state: MainWindowCloseGuardState,
): boolean => state.installTaskCount > 0 || state.hasRunningUpdateCenterTasks;
export const getMainWindowCloseAction = (
state: MainWindowCloseGuardState,
): MainWindowCloseAction =>
shouldPreventMainWindowClose(state) ? "hide" : "destroy";