Give a name to function for updating book count

Extracts function updateBookCount() from the unnamed function in resize event.
This commit is contained in:
Nikhil Tanwar 2022-07-16 21:14:03 +05:30
parent 9f545718c2
commit 489dfc1123
1 changed files with 4 additions and 2 deletions

View File

@ -429,13 +429,15 @@
} }
} }
window.addEventListener('resize', (event) => { function updateBookCount(event) {
if (timer) {clearTimeout(timer)} if (timer) {clearTimeout(timer)}
timer = setTimeout(() => { timer = setTimeout(() => {
incrementalLoadingParams.count = incrementalLoadingParams.count && viewPortToCount(); incrementalLoadingParams.count = incrementalLoadingParams.count && viewPortToCount();
loadSubset(); loadSubset();
}, 100, event); }, 100, event);
}); }
window.addEventListener('resize', (event) => updateBookCount(event));
window.addEventListener('scroll', loadSubset); window.addEventListener('scroll', loadSubset);