mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -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 pagingComponent = ref<InstanceType<typeof MkPagination>>();
|
||||||
|
|
||||||
const interval = ref<NodeJS.Timer>();
|
const interval = ref<NodeJS.Timer>();
|
||||||
const lastFetchScrollTop = ref(document.documentElement.clientHeight / 2 * -1);
|
const lastFetchScrollTop = ref(document.documentElement.clientHeight * -0.5);
|
||||||
|
|
||||||
function scrollTop() {
|
function scrollTop() {
|
||||||
if (!tlEl.value) return;
|
if (!tlEl.value) return;
|
||||||
|
@ -66,7 +66,8 @@ function setTimer() {
|
||||||
interval.value = setInterval(() => {
|
interval.value = setInterval(() => {
|
||||||
const viewport = document.documentElement.clientHeight;
|
const viewport = document.documentElement.clientHeight;
|
||||||
const left = document.documentElement.scrollHeight - document.documentElement.scrollTop;
|
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();
|
pagingComponent.value.prefetchMore();
|
||||||
lastFetchScrollTop.value = document.documentElement.scrollTop;
|
lastFetchScrollTop.value = document.documentElement.scrollTop;
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
Loading…
Reference in a new issue