diff --git a/web/src/app/js/base.js b/web/src/app/js/base.js index 7f8516c..e3f844c 100644 --- a/web/src/app/js/base.js +++ b/web/src/app/js/base.js @@ -121,6 +121,15 @@ function loadScript(id, file, cback) { function getNormalizedURI() { return window.location.pathname.replace(/\/+?$/, '') } function capitalize(s) { return s.charAt(0).toUpperCase() + s.substr(1) } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)) } +async function waitUntil(cback, secs) { + var i = 0; + while (i < secs) { + if (cback()) + return; + await sleep(1000); + i++; + } +} function s(name) { if (app.strings === undefined || !name.match(/^[a-zA-Z0-9\.\_]+$/))