style: add no-misused-promises rule (#3547)

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
LongYinan
2023-08-04 16:08:10 +08:00
committed by GitHub
parent f8e49ee3be
commit 5795020403
19 changed files with 130 additions and 74 deletions
+15 -10
View File
@@ -115,21 +115,26 @@ export const toast = (
element.animate(fadeIn, options);
setTimeout(async () => {
setTimeout(() => {
const animation = element.animate(
// fade out
fadeIn.reverse(),
options
);
await animation.finished;
element.style.maxHeight = '0';
element.style.margin = '0';
element.style.padding = '0';
// wait for transition
// ToastContainer = null;
element.addEventListener('transitionend', () => {
element.remove();
});
animation.finished
.then(() => {
element.style.maxHeight = '0';
element.style.margin = '0';
element.style.padding = '0';
// wait for transition
// ToastContainer = null;
element.addEventListener('transitionend', () => {
element.remove();
});
})
.catch(err => {
console.error(err);
});
}, duration);
return element;
};