提交 b9da7f73 编写于 作者: J Johannes Rieken

fix #29410

上级 3c74782e
......@@ -87,14 +87,26 @@ export class ProgressService2 implements IProgressService2 {
const task: [IProgressOptions, Progress<IProgressStep>] = [options, new Progress<IProgressStep>(() => this._updateWindowProgress())];
const promise = callback(task[1]);
this._stack.unshift(task);
this._updateWindowProgress();
always(promise, () => {
const idx = this._stack.indexOf(task);
this._stack.splice(idx, 1);
let delayHandle = setTimeout(() => {
delayHandle = undefined;
this._stack.unshift(task);
this._updateWindowProgress();
});
// show progress for at least 150ms
always(TPromise.join([
TPromise.timeout(150),
promise
]), () => {
const idx = this._stack.indexOf(task);
this._stack.splice(idx, 1);
this._updateWindowProgress();
});
}, 150);
// cancel delay if promise finishes below 150ms
always(promise, () => clearTimeout(delayHandle));
}
private _updateWindowProgress(idx: number = 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册