Don't timeout
This commit is contained in:
parent
bb7b1e282f
commit
7d85f200ca
|
@ -52,7 +52,7 @@ function actually_do_sort(elem) {
|
||||||
|
|
||||||
function wait_for(elem_selector, callback) {
|
function wait_for(elem_selector, callback) {
|
||||||
var tries = 0;
|
var tries = 0;
|
||||||
var maxtries = 35;
|
var maxtries = 0;
|
||||||
var wantit = 1;
|
var wantit = 1;
|
||||||
var actually_wait = function() {
|
var actually_wait = function() {
|
||||||
var elem = document.querySelector(elem_selector);
|
var elem = document.querySelector(elem_selector);
|
||||||
|
@ -64,7 +64,7 @@ function wait_for(elem_selector, callback) {
|
||||||
setTimeout(actually_wait, 250 * Math.pow(1.1, tries));
|
setTimeout(actually_wait, 250 * Math.pow(1.1, tries));
|
||||||
} else {
|
} else {
|
||||||
tries++;
|
tries++;
|
||||||
if (tries >= maxtries) {
|
if (maxtries != 0 && tries >= maxtries) {
|
||||||
console.warn('doesnt exist after ' + maxtries + ' attempts: ' + elem_selector);
|
console.warn('doesnt exist after ' + maxtries + ' attempts: ' + elem_selector);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(actually_wait, 250 * Math.pow(1.1, tries));
|
setTimeout(actually_wait, 250 * Math.pow(1.1, tries));
|
||||||
|
@ -73,7 +73,7 @@ function wait_for(elem_selector, callback) {
|
||||||
} else {
|
} else {
|
||||||
if (elem) {
|
if (elem) {
|
||||||
tries++;
|
tries++;
|
||||||
if (tries >= maxtries) {
|
if (maxtries != 0 && tries >= maxtries) {
|
||||||
console.warn('still exists after ' + maxtries + ' attempts: ' + elem_selector);
|
console.warn('still exists after ' + maxtries + ' attempts: ' + elem_selector);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(actually_wait, 250 * Math.pow(1.1, tries));
|
setTimeout(actually_wait, 250 * Math.pow(1.1, tries));
|
||||||
|
|
Loading…
Reference in New Issue