Last active
November 12, 2022 23:54
-
-
Save Cside/8a1cea54fb08878d1a5a3bdad298fa20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const waitFor = (selector: string): Promise<NodeList> => { | |
return new Promise(resolve => { | |
const id = setInterval(() => { | |
const elems = document.querySelectorAll(selector); | |
if (elems.length >= 0) { | |
clearInterval(id); | |
resolve(elems); | |
} | |
}, 300); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function waitFor(selector) { | |
return new Promise(resolve => { | |
const id = setInterval(() => { | |
const elems = document.querySelectorAll(selector); | |
if (elems.length >= 0) { | |
clearInterval(id); | |
resolve(elems); | |
} | |
}, 200); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment