app_js/glightbox/src/js/glightbox.js
/**
 * Wait until
 * wait until all the validations
 * are passed
 *
 * @param {function} check
 * @param {function} onComplete
 * @param {numeric} delay
 * @param {numeric} timeout
 */
Wait until
wait until all the validations
are passed


Wait until wait until all the validations are passed
function waitUntil(check, onComplete, delay, timeout) {
    if (check()) {
        onComplete();
        return;
    }
    if (!delay) delay = 100;
    let timeoutPointer;
    let intervalPointer = setInterval(() => {
        if (!check()) return;
        clearInterval(intervalPointer);
        if (timeoutPointer) clearTimeout(timeoutPointer);
        onComplete();
    }, delay);
    if (timeout) timeoutPointer = setTimeout(() => {
        clearInterval(intervalPointer);
    }, timeout);
}
function waitUntil ( check , onComplete , delay , timeout ) { if ( check ( ) ) { onComplete ( ) ; return ; } if ( ! delay ) delay = 100 ; let timeoutPointer ; let intervalPointer = setInterval ( ( ) => { if ( ! check ( ) ) return ; clearInterval ( intervalPointer ) ; if ( timeoutPointer ) clearTimeout ( timeoutPointer ) ; onComplete ( ) ; } , delay ) ; if ( timeout ) timeoutPointer = setTimeout ( ( ) => { clearInterval ( intervalPointer ) ; } , timeout ) ; }
Wait until
 wait until all the validations
 are passed
Wait until wait until all the validations are passed