mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(web): cleanup promise handling (#7382)
* no-misused-promises * no-floating-promises * format * revert for now * remove load function * require-await * revert a few no-floating-promises changes that would cause no-misused-promises failures * format * fix a few more * fix most remaining errors * executor-queue * executor-queue.spec * remove duplicate comments by grouping rules * upgrade sveltekit and enforce rules * oops. move await * try this * just ignore for now since it's only a test * run in parallel * Update web/src/routes/admin/jobs-status/+page.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * remove Promise.resolve call * rename function * remove unnecessary warning silencing * make handleError sync * fix new errors from recently merged PR to main * extract method * use handlePromiseError --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
57f25855d3
commit
907a95a746
70 changed files with 312 additions and 282 deletions
|
|
@ -6,6 +6,8 @@
|
|||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { handlePromiseError } from '$lib/utils';
|
||||
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import { tweened } from 'svelte/motion';
|
||||
|
||||
|
|
@ -24,14 +26,14 @@
|
|||
|
||||
export let duration = 5;
|
||||
|
||||
const onChange = () => {
|
||||
const onChange = async () => {
|
||||
progress = setDuration(duration);
|
||||
play();
|
||||
await play();
|
||||
};
|
||||
|
||||
let progress = setDuration(duration);
|
||||
|
||||
$: duration, onChange();
|
||||
$: duration, handlePromiseError(onChange());
|
||||
|
||||
$: {
|
||||
if ($progress === 1) {
|
||||
|
|
@ -45,35 +47,35 @@
|
|||
paused: void;
|
||||
}>();
|
||||
|
||||
onMount(() => {
|
||||
onMount(async () => {
|
||||
if (autoplay) {
|
||||
play();
|
||||
await play();
|
||||
}
|
||||
});
|
||||
|
||||
export const play = () => {
|
||||
export const play = async () => {
|
||||
status = ProgressBarStatus.Playing;
|
||||
dispatch('playing');
|
||||
progress.set(1);
|
||||
await progress.set(1);
|
||||
};
|
||||
|
||||
export const pause = () => {
|
||||
export const pause = async () => {
|
||||
status = ProgressBarStatus.Paused;
|
||||
dispatch('paused');
|
||||
progress.set($progress);
|
||||
await progress.set($progress);
|
||||
};
|
||||
|
||||
export const restart = (autoplay: boolean) => {
|
||||
progress.set(0);
|
||||
export const restart = async (autoplay: boolean) => {
|
||||
await progress.set(0);
|
||||
|
||||
if (autoplay) {
|
||||
play();
|
||||
await play();
|
||||
}
|
||||
};
|
||||
|
||||
export const reset = () => {
|
||||
export const reset = async () => {
|
||||
status = ProgressBarStatus.Paused;
|
||||
progress.set(0);
|
||||
await progress.set(0);
|
||||
};
|
||||
|
||||
function setDuration(newDuration: number) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue