mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Fix leaked interval in dialog
This commit is contained in:
parent
21be97cbfc
commit
259658eb28
|
@ -40,7 +40,7 @@ export class Dialog extends Disposable {
|
|||
private buttonGroup: ButtonGroup | undefined;
|
||||
private styles: IDialogStyles | undefined;
|
||||
private focusToReturn: HTMLElement | undefined;
|
||||
private iconRotatingInternal: any | undefined;
|
||||
private iconRotatingInternal: NodeJS.Timer | undefined;
|
||||
|
||||
constructor(private container: HTMLElement, private message: string, private buttons: string[], private options: IDialogOptions) {
|
||||
super();
|
||||
|
@ -169,7 +169,7 @@ export class Dialog extends Disposable {
|
|||
this.iconElement.style.transform = `rotate(${deg}deg)`;
|
||||
deg += 45; // 360 / 8
|
||||
} else {
|
||||
this.iconRotatingInternal = undefined;
|
||||
this.stopAnimation();
|
||||
}
|
||||
}, 125 /** 1000 / 8 */);
|
||||
break;
|
||||
|
@ -199,6 +199,13 @@ export class Dialog extends Disposable {
|
|||
});
|
||||
}
|
||||
|
||||
private stopAnimation() {
|
||||
if (this.iconRotatingInternal) {
|
||||
clearInterval(this.iconRotatingInternal);
|
||||
this.iconRotatingInternal = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private applyStyles() {
|
||||
if (this.styles) {
|
||||
const style = this.styles;
|
||||
|
@ -233,9 +240,7 @@ export class Dialog extends Disposable {
|
|||
this.modal = undefined;
|
||||
}
|
||||
|
||||
if (this.iconRotatingInternal) {
|
||||
this.iconRotatingInternal = undefined;
|
||||
}
|
||||
this.stopAnimation();
|
||||
|
||||
if (this.focusToReturn && isAncestor(this.focusToReturn, document.body)) {
|
||||
this.focusToReturn.focus();
|
||||
|
|
Loading…
Reference in a new issue