Handle mobile viewer

This commit is contained in:
ZXY101
2023-10-02 12:05:26 +02:00
parent 83ae19f510
commit 310febe53c
7 changed files with 162 additions and 40 deletions

View File

@@ -7,4 +7,19 @@ export function clamp(num: number, min: number, max: number) {
export function isReader() {
return get(page).route.id === '/[manga]/[volume]'
}
let timer: any;
export function debounce(func: () => void, timeout = 50) {
if (!timer) {
timer = setTimeout(() => {
func();
clearTimeout(timer);
timer = undefined;
}, timeout);
} else {
clearTimeout(timer);
timer = undefined;
}
}