TSK-1163: fixed minor timeout bug for alert component

This commit is contained in:
Mustapha Zorgati 2020-03-17 10:51:06 +01:00
parent 76c59ed3f7
commit 9b79968f9b
1 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import { expandTop } from '../animations/expand.animation';
export class AlertComponent implements OnInit {
alert: AlertModel;
private timeoutId: any; //NodeJS.Timer cannot be imported..
constructor(private alertService: AlertService) { }
ngOnInit() {
@ -25,7 +26,8 @@ export class AlertComponent implements OnInit {
}
setTimeOutForClosing(time: number) {
setTimeout(() => {
clearTimeout(this.timeoutId);
this.timeoutId = setTimeout(() => {
delete this.alert;
}, time);
}