catch promise

This commit is contained in:
2023-03-07 13:03:51 +10:00
parent b62a3b9d63
commit 57092e1b26
2 changed files with 33 additions and 25 deletions

View File

@@ -65,14 +65,18 @@ const mediaItems: Ref<Media[]> = ref([]);
* Handle the user adding a new media item.
*/
const handleClickAdd = async () => {
openDialog(SMDialogMedia, { mime: "", accepts: "" }).then((result) => {
const media = result as Media;
openDialog(SMDialogMedia, { mime: "", accepts: "" })
.then((result) => {
const media = result as Media;
mediaItems.value.push(media);
value.value.push(media.id);
mediaItems.value.push(media);
value.value.push(media.id);
emits("update:modelValue", value);
});
emits("update:modelValue", value);
})
.catch(() => {
/* empty */
});
};
/**

View File

@@ -66,25 +66,29 @@ const waitForElementRender = (elem: Ref): Promise<HTMLElement> => {
* @returns {void}
*/
export const transitionEnter = (elem: Ref, transition: string): void => {
waitForElementRender(elem).then((e: HTMLElement) => {
window.setTimeout(() => {
e.classList.replace(
transition + "-enter-from",
transition + "-enter-active"
);
const transitionName = transitionEndEventName();
e.addEventListener(
transitionName,
() => {
e.classList.replace(
transition + "-enter-active",
transition + "-enter-to"
);
},
false
);
}, 1);
});
waitForElementRender(elem)
.then((e: HTMLElement) => {
window.setTimeout(() => {
e.classList.replace(
transition + "-enter-from",
transition + "-enter-active"
);
const transitionName = transitionEndEventName();
e.addEventListener(
transitionName,
() => {
e.classList.replace(
transition + "-enter-active",
transition + "-enter-to"
);
},
false
);
}, 1);
})
.catch(() => {
/* empty */
});
};
/**