bdy 1.9.7 → 1.9.8-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/distTs/package.json
CHANGED
|
@@ -229,16 +229,21 @@ async function autoScroll(page) {
|
|
|
229
229
|
await page.evaluate(async () => {
|
|
230
230
|
await new Promise((resolve) => {
|
|
231
231
|
const resourceDiscoveryMaxHeight = 30_000;
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
const step = 100;
|
|
233
|
+
let currentScroll = 0;
|
|
234
234
|
const timer = setInterval(() => {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
const pageHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
|
|
236
|
+
const newScrollPosition = currentScroll + step;
|
|
237
|
+
window.scrollTo({
|
|
238
|
+
top: newScrollPosition,
|
|
239
|
+
left: 0,
|
|
240
|
+
behavior: 'instant',
|
|
241
|
+
});
|
|
242
|
+
currentScroll = newScrollPosition;
|
|
243
|
+
if (newScrollPosition >= pageHeight ||
|
|
244
|
+
newScrollPosition >= resourceDiscoveryMaxHeight) {
|
|
240
245
|
clearInterval(timer);
|
|
241
|
-
resolve('');
|
|
246
|
+
resolve('done');
|
|
242
247
|
}
|
|
243
248
|
}, 10);
|
|
244
249
|
});
|