Prevented error notification being visible on load

Fixes #897

Also made design a little more compact
This commit is contained in:
Dan Brown
2018-07-29 15:34:54 +01:00
parent 6d35fb5237
commit 69a0f8d502
4 changed files with 19 additions and 16 deletions

View File

@ -6,11 +6,16 @@ class Notification {
this.type = elem.getAttribute('notification');
this.textElem = elem.querySelector('span');
this.autohide = this.elem.hasAttribute('data-autohide');
this.elem.style.display = 'grid';
window.$events.listen(this.type, text => {
this.show(text);
});
elem.addEventListener('click', this.hide.bind(this));
if (elem.hasAttribute('data-show')) this.show(this.textElem.textContent);
if (elem.hasAttribute('data-show')) {
setTimeout(() => this.show(this.textElem.textContent), 100);
}
this.hideCleanup = this.hideCleanup.bind(this);
}