优化
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user