sync: sync wip stuff
This commit is contained in:
23
src/gui/Alert.ts
Normal file
23
src/gui/Alert.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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}`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user