Files
genieacs/ui/notifications.js
T
Zaid Abdulla ee8c43747e Refactor components
Implement context mechanism to pass default attributes to descendant
components.
2019-02-12 23:11:27 -08:00

20 lines
364 B
JavaScript

"use strict";
import m from "mithril";
const notifications = new Set();
export 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);
}
export function getNotifications() {
return notifications;
}