This commit is contained in:
2025-09-22 13:23:12 +08:00
parent e3ff2045ea
commit 16b4b27352
14 changed files with 167 additions and 169 deletions

View File

@@ -66,12 +66,18 @@ export default class ProcessImpl implements IProcess {
try {
const wf = this._windowForms.get(id);
if (!wf) throw new Error(`未找到窗体:${id}`);
wf.destroy();
this.windowForms.delete(id)
if(this.windowForms.size === 0) {
this.destroy()
processManager.removeProcess(this)
}
} catch (e) {
console.log('关闭窗体失败', e)
}
}
public destroy() {
this._event.destroy()
}
}

View File

@@ -37,9 +37,10 @@ export default class ProcessManagerImpl implements IProcessManager {
this._processInfos.push(...internalProcessInfos)
}
public async runProcess<T extends IProcess = IProcess>(
public async runProcess<T extends IProcess = IProcess, A extends any[] = any[]>(
proc: string | IProcessInfo,
constructor?: new (info: IProcessInfo) => T,
constructor?: new (info: IProcessInfo, ...args: A) => T,
...args: A
): Promise<T> {
let info = typeof proc === 'string' ? this.findProcessInfoByName(proc) : proc
if (isUndefined(info)) {
@@ -55,7 +56,7 @@ export default class ProcessManagerImpl implements IProcessManager {
}
// 创建进程
let process = isUndefined(constructor) ? new ProcessImpl(info) : new constructor(info)
let process = isUndefined(constructor) ? new ProcessImpl(info) : new constructor(info, ...args)
return process as T
}