Implement task queue and notifications

This commit is contained in:
Zaid Abdulla committed 2018-12-26 00:22:07 -08:00
1 parent 9b827c5f5e
commit b24c3626ac
20 files changed
+1000 -88

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
"use strict";
import m from "mithril";
const notifications = new Set();
function push(type, message) {
const n = { type: type, message: message, timestamp: Date.now() };
notifications.add(n);
m.redraw();
setTimeout(() => {
notifications.delete(n);
m.redraw();
}, 4000);
}
function getNotifications() {
return notifications;
}
export { push, getNotifications };