Revert "Update api fetching"
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This reverts commit b921801e6a
.
This commit is contained in:
parent
b921801e6a
commit
6a45b8b6bc
1 changed files with 6 additions and 13 deletions
|
@ -5,6 +5,10 @@
|
||||||
let listingIndex = 0;
|
let listingIndex = 0;
|
||||||
|
|
||||||
function updateListingIndex(amount: number): void {
|
function updateListingIndex(amount: number): void {
|
||||||
|
if (listingIndex == amount - 2) {
|
||||||
|
fetchData = api.fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
if (listingIndex >= amount - 1) {
|
if (listingIndex >= amount - 1) {
|
||||||
listingIndex = 0;
|
listingIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,25 +16,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTime(
|
function handleTime(time: number, listingsAmount: number): void {
|
||||||
time: number,
|
|
||||||
index: number,
|
|
||||||
listingsAmount: number
|
|
||||||
): void {
|
|
||||||
if (index == listingsAmount - 2) {
|
|
||||||
fetchData = api.fetchData();
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => updateListingIndex(listingsAmount), time * 1000);
|
setTimeout(() => updateListingIndex(listingsAmount), time * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleVideoLoad(
|
function handleVideoLoad(
|
||||||
time: number | undefined,
|
time: number | undefined,
|
||||||
index: number,
|
|
||||||
listingsAmount: number
|
listingsAmount: number
|
||||||
): void {
|
): void {
|
||||||
if (time) {
|
if (time) {
|
||||||
handleTime(time, index, listingsAmount);
|
handleTime(time, listingsAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -49,7 +44,6 @@
|
||||||
on:load={() =>
|
on:load={() =>
|
||||||
handleTime(
|
handleTime(
|
||||||
data.listings[listingIndex].time || 10,
|
data.listings[listingIndex].time || 10,
|
||||||
listingIndex,
|
|
||||||
data.listings.length
|
data.listings.length
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
@ -61,7 +55,6 @@
|
||||||
on:load={() =>
|
on:load={() =>
|
||||||
handleVideoLoad(
|
handleVideoLoad(
|
||||||
data.listings[listingIndex].time,
|
data.listings[listingIndex].time,
|
||||||
listingIndex,
|
|
||||||
data.listings.length
|
data.listings.length
|
||||||
)}
|
)}
|
||||||
on:ended={() => updateListingIndex(data.listings.length)}
|
on:ended={() => updateListingIndex(data.listings.length)}
|
||||||
|
|
Loading…
Reference in a new issue