Skip to content

Instantly share code, notes, and snippets.

function waitForSelector(selector,cb, limit = 30) {
if(limit === 0) return
if(document.querySelector(selector)) {
cb()
} else {
setTimeout(() => {waitForSelector(selector,cb, limit --)},300)
}
}