Files
webshell/src/gui/Alert.ts
2026-05-18 00:14:49 +02:00

24 lines
700 B
TypeScript

import HtmlAlertTemplate from "./alertTemplate.html?raw"
export type AlertSeverity = 'debug' | 'info' | 'warning' | 'error' | 'critical'
export class Alert {
readonly title: string
readonly description: string
readonly severity: AlertSeverity
// a html5 template
readonly template: string
constructor(title: string, description: string, severity: AlertSeverity, template: string = HtmlAlertTemplate) {
this.title = title
this.description = description
this.severity = severity
this.template = template
}
Show(time: number = -1): void {
alert(`${this.title} [${this.severity}]: ${this.description} (time: ${time})`)
}
}