PDF-Forge/src/models/ForgeNotification.svelte.ts
2025-02-10 12:07:25 +01:00

27 lines
828 B
TypeScript

export class ForgeNotification {
public timestamp: number;
date: Date;
public level: string;
public message: string;
public read: boolean = false;
constructor(timestamp: number, level: string, message: string) {
this.timestamp = timestamp;
this.level = level;
this.message = message;
this.date = new Date(timestamp);
}
public getDate(): string {
const hours = this.date.getHours().toString().padStart(2, '0');
const minutes = this.date.getMinutes().toString().padStart(2, '0');
const seconds = this.date.getSeconds().toString().padStart(2, '0');
return `${hours}:${minutes}:${seconds}`;
}
public isError() {
return this.level === "ERROR";
}
public isDebug() {
return this.level === "DEBUG";
}
}