diff options
author | crupest <crupest@outlook.com> | 2023-08-31 02:19:01 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-08-31 02:19:01 +0800 |
commit | 4a6d8c606fab0215065ce65d2f105fafd8db7169 (patch) | |
tree | 9b4231c70123b6801ab341f944d0f29ed95af6c1 /FrontEnd/src/components/alert/AlertService.ts | |
parent | fb64a8f3d4a7dd4035f50ccf2601ae0a683bd1b8 (diff) | |
download | timeline-4a6d8c606fab0215065ce65d2f105fafd8db7169.tar.gz timeline-4a6d8c606fab0215065ce65d2f105fafd8db7169.tar.bz2 timeline-4a6d8c606fab0215065ce65d2f105fafd8db7169.zip |
...
Diffstat (limited to 'FrontEnd/src/components/alert/AlertService.ts')
-rw-r--r-- | FrontEnd/src/components/alert/AlertService.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/FrontEnd/src/components/alert/AlertService.ts b/FrontEnd/src/components/alert/AlertService.ts index b3565b8a..b9cda752 100644 --- a/FrontEnd/src/components/alert/AlertService.ts +++ b/FrontEnd/src/components/alert/AlertService.ts @@ -1,5 +1,7 @@ import { ThemeColor, Text } from "../common"; +const defaultDismissTime = 5000; + export interface AlertInfo { color?: ThemeColor; message: Text; @@ -50,7 +52,7 @@ export class AlertService { timerId: null, }; - this.alerts.push(newAlert); + this.alerts = [...this.alerts, newAlert]; this._resetDismissTimer(newAlert); this.notify(); @@ -91,7 +93,8 @@ export class AlertService { ) { this._clearDismissTimer(alert); - const realDismissTime = dismissTime ?? alert.dismissTime; + const realDismissTime = + dismissTime ?? alert.dismissTime ?? defaultDismissTime; if (typeof realDismissTime === "number") { alert.timerId = window.setTimeout(() => { |