TypeScript!

This commit is contained in:
Zaid Abdulla committed 2019-02-20 03:36:52 -08:00
1 parent ee8c43747e
commit 5d3c81cb23
105 files changed
+12054 -1901

No files matched your search

+23
View File
@@ -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;
}