while(true) {
let center_block = document.querySelector(...)
func()
center_block.scrollBy(0, 100)
if(center_block.scrollHeight <= center_block.scrollTop + center_block.clientHeight) {
break
}
}
async function scrollAndExecute() {
while (true) {
let center_block = document.querySelector(...);
func();
center_block.scrollBy(0, 100);
await new Promise(resolve => setTimeout(resolve, 100));
if (center_block.scrollHeight <= center_block.scrollTop + center_block.clientHeight) {
break;
}
}
}