Skip to content

Instantly share code, notes, and snippets.

@szmeku
Created September 3, 2017 14:50
Show Gist options
  • Select an option

  • Save szmeku/28091848a15e497903965920982ab188 to your computer and use it in GitHub Desktop.

Select an option

Save szmeku/28091848a15e497903965920982ab188 to your computer and use it in GitHub Desktop.
window.futureQuerySelectorAll = selector => new Promise(resolve => {
let checkExist = setInterval(function() {
if (document.querySelectorAll(selector).length > 0) {
resolve(Array.from(document.querySelectorAll(selector)));
clearInterval(checkExist);
}
}, 100);
});
window.querySelectorAllAsArray = selector => Array.from(document.querySelectorAll(selector))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment