Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save frontend-sensei/c72cc86e295676f144e91727f40f37ed to your computer and use it in GitHub Desktop.
Save frontend-sensei/c72cc86e295676f144e91727f40f37ed to your computer and use it in GitHub Desktop.
Test
function wait(milliseconds) {
return new Promise((resolve, reject) => {
setTimeout(resolve, milliseconds);
});
}
function waitForSelector(selector) {
const wait = new Promise((resolve, reject) => {
let checkExist = setInterval(function () {
if (document.querySelector(selector)) {
clearInterval(checkExist);
resolve();
}
}, 100);
});
return wait;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment