1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-04 17:46:42 +02:00
php-web-maker/src/notifications.js
2018-06-19 10:34:38 +05:30

22 lines
545 B
JavaScript

var hideTimeout;
function addNotification(msg) {
const noticationContainerEL = $('#js-alerts-container');
// 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);
}
export const alertsService = {
add: addNotification
};
window.alertsService = alertsService;