From 489dfc11237187dbe0b8aa5a3aef61d77b83ae41 Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Sat, 16 Jul 2022 21:14:03 +0530 Subject: [PATCH] Give a name to function for updating book count Extracts function updateBookCount() from the unnamed function in resize event. --- static/skin/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/skin/index.js b/static/skin/index.js index fd1c338e..a0f5441f 100644 --- a/static/skin/index.js +++ b/static/skin/index.js @@ -429,13 +429,15 @@ } } - window.addEventListener('resize', (event) => { + function updateBookCount(event) { if (timer) {clearTimeout(timer)} timer = setTimeout(() => { incrementalLoadingParams.count = incrementalLoadingParams.count && viewPortToCount(); loadSubset(); }, 100, event); - }); + } + + window.addEventListener('resize', (event) => updateBookCount(event)); window.addEventListener('scroll', loadSubset);