rename js sleep to asyncSleepFor (#2016)

This commit is contained in:
Shuchang Zheng
2025-03-25 02:28:31 -07:00
committed by GitHub
parent 22e92bdb3a
commit 915bcfbf13

View File

@@ -2165,7 +2165,7 @@ function waitForNextFrame() {
}); });
} }
function sleep(ms) { function asyncSleepFor(ms) {
return new Promise((resolve) => setTimeout(resolve, ms)); return new Promise((resolve) => setTimeout(resolve, ms));
} }
@@ -2311,7 +2311,7 @@ async function stopGlobalIncrementalObserver() {
(await window.globalParsedElementCounter.get()) < (await window.globalParsedElementCounter.get()) <
window.globalOneTimeIncrementElements.length window.globalOneTimeIncrementElements.length
) { ) {
await sleep(100); await asyncSleepFor(100);
} }
window.globalOneTimeIncrementElements = []; window.globalOneTimeIncrementElements = [];
window.globalDomDepthMap = new Map(); window.globalDomDepthMap = new Map();
@@ -2322,7 +2322,7 @@ async function getIncrementElements() {
(await window.globalParsedElementCounter.get()) < (await window.globalParsedElementCounter.get()) <
window.globalOneTimeIncrementElements.length window.globalOneTimeIncrementElements.length
) { ) {
await sleep(100); await asyncSleepFor(100);
} }
// cleanup the chidren tree, remove the duplicated element // cleanup the chidren tree, remove the duplicated element