View gist:6dde02f8c125e3de377e7709799b7c73
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 waitForSelector(selector,cb, limit = 30) { | |
if(limit === 0) return | |
if(document.querySelector(selector)) { | |
cb() | |
} else { | |
setTimeout(() => {waitForSelector(selector,cb, limit --)},300) | |
} | |
} |