mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-21 17:37:29 -07:00
[client] Adjust timeline prefetch parameters
This commit is contained in:
parent
ff55cad0fb
commit
c742729796
1 changed files with 3 additions and 2 deletions
|
@ -54,7 +54,7 @@ const props = defineProps<{
|
|||
const pagingComponent = ref<InstanceType<typeof MkPagination>>();
|
||||
|
||||
const interval = ref<NodeJS.Timer>();
|
||||
const lastFetchScrollTop = ref(document.documentElement.clientHeight / 2 * -1);
|
||||
const lastFetchScrollTop = ref(document.documentElement.clientHeight * -0.5);
|
||||
|
||||
function scrollTop() {
|
||||
if (!tlEl.value) return;
|
||||
|
@ -66,7 +66,8 @@ function setTimer() {
|
|||
interval.value = setInterval(() => {
|
||||
const viewport = document.documentElement.clientHeight;
|
||||
const left = document.documentElement.scrollHeight - document.documentElement.scrollTop;
|
||||
if (left > viewport * 3 || document.documentElement.scrollTop - lastFetchScrollTop.value < viewport) return;
|
||||
console.log(document.documentElement.scrollTop - lastFetchScrollTop.value);
|
||||
if (left > Math.max(viewport * 3, 4000) || document.documentElement.scrollTop - lastFetchScrollTop.value < viewport) return;
|
||||
pagingComponent.value.prefetchMore();
|
||||
lastFetchScrollTop.value = document.documentElement.scrollTop;
|
||||
}, 100);
|
||||
|
|
Loading…
Reference in a new issue