increase stocks in watchlist

This commit is contained in:
MuslemRahimi 2025-04-16 09:45:04 +02:00
parent 3ae53d4fd7
commit 16046af594

View File

@ -669,6 +669,16 @@
} }
} }
async function handleScrollStocks() {
const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height
const isBottom = window.innerHeight + window.scrollY >= scrollThreshold;
if (isBottom && displayList?.length !== rawTabData?.length) {
const nextIndex = displayList?.length;
const filteredItem = rawTabData?.slice(nextIndex, nextIndex + 8);
displayList = [...displayList, ...filteredItem];
}
}
// Helper function to safely parse JSON // Helper function to safely parse JSON
function safeParse(value) { function safeParse(value) {
try { try {
@ -757,8 +767,11 @@
} }
window.addEventListener("scroll", handleScroll); window.addEventListener("scroll", handleScroll);
window.addEventListener("scroll", handleScrollStocks);
return () => { return () => {
window.removeEventListener("scroll", handleScroll); window.removeEventListener("scroll", handleScroll);
window.removeEventListener("scroll", handleScrollStocks);
}; };
}); });