mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-25 11:07:56 +08:00
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:
@ -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);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user