Skip to content

Instantly share code, notes, and snippets.

Avatar

Kermin Zahirovic kerminz

View GitHub Profile
@PaulKinlan
PaulKinlan / waitForElement.js
Last active Jun 20, 2021
waitForElement.js
View waitForElement.js
function waitForElement(selector) {
return new Promise(function(resolve, reject) {
var element = document.querySelector(selector);
if(element) {
resolve(element);
return;
}
var observer = new MutationObserver(function(mutations) {