Zoom and Pan: simplify waitForOpts

This commit is contained in:
Aarni Koskela 2023-06-05 10:39:57 +03:00
parent 6163b38ad9
commit 2d4c66f7b5
1 changed files with 6 additions and 8 deletions

View File

@ -34,14 +34,12 @@ onUiLoaded(async() => {
// Wait until opts loaded
async function waitForOpts() {
return new Promise(resolve => {
const checkInterval = setInterval(() => {
if (window.opts && Object.keys(window.opts).length !== 0) {
clearInterval(checkInterval);
resolve(window.opts);
}
}, 100);
});
for (;;) {
if (window.opts && Object.keys(window.opts).length) {
return window.opts;
}
await new Promise(resolve => setTimeout(resolve, 100));
}
}
// Check is hotkey valid