TypeScript!
This commit is contained in:
1 parent
ee8c43747e
commit
5d3c81cb23
105 files changed
+12054
-1901
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import m from "mithril";
|
||||
|
||||
interface Notification {
|
||||
type: string;
|
||||
message: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
const notifications = new Set<Notification>();
|
||||
|
||||
export function push(type, message): void {
|
||||
const n = { type: type, message: message, timestamp: Date.now() };
|
||||
notifications.add(n);
|
||||
m.redraw();
|
||||
setTimeout(() => {
|
||||
notifications.delete(n);
|
||||
m.redraw();
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
export function getNotifications(): Set<Notification> {
|
||||
return notifications;
|
||||
}
|
||||
Reference in new issue
Block a user