Created
March 2, 2022 12:01
-
-
Save frontend-sensei/c72cc86e295676f144e91727f40f37ed to your computer and use it in GitHub Desktop.
Test
This file contains hidden or 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 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