1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-02 19:37:29 +02:00
Files
php-web-maker/src/notifications.js

22 lines
535 B
JavaScript

(function() {
const noticationContainerEL = $('#js-alerts-container');
var hideTimeout;
function addNotification(msg) {
// var n = document.createElement('div');
// div.textContent = msg;
// noticationContainerEL.appendChild(n);
noticationContainerEL.textContent = msg;
noticationContainerEL.classList.add('is-active');
clearTimeout(hideTimeout);
hideTimeout = setTimeout(function() {
noticationContainerEL.classList.remove('is-active');
}, 2000);
}
window.alertsService = {
add: addNotification
};
})();