Make toast support preventDuplicates (#31501)
make preventDuplicates default to true, users get a clear UI feedback and know that "a new message appears". Fixes: https://github.com/go-gitea/gitea/issues/26651 --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
9bc5552c11
commit
c1fe6fbcc3
8 changed files with 86 additions and 39 deletions
|
@ -306,3 +306,14 @@ export function createElementFromAttrs(tagName, attrs) {
|
|||
}
|
||||
return el;
|
||||
}
|
||||
|
||||
export function animateOnce(el, animationClassName) {
|
||||
return new Promise((resolve) => {
|
||||
el.addEventListener('animationend', function onAnimationEnd() {
|
||||
el.classList.remove(animationClassName);
|
||||
el.removeEventListener('animationend', onAnimationEnd);
|
||||
resolve();
|
||||
}, {once: true});
|
||||
el.classList.add(animationClassName);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue