Commit 2d4c66f7 authored by Aarni Koskela's avatar Aarni Koskela

Zoom and Pan: simplify waitForOpts

parent 6163b38a
...@@ -34,14 +34,12 @@ onUiLoaded(async() => { ...@@ -34,14 +34,12 @@ onUiLoaded(async() => {
// Wait until opts loaded // Wait until opts loaded
async function waitForOpts() { async function waitForOpts() {
return new Promise(resolve => { for (;;) {
const checkInterval = setInterval(() => { if (window.opts && Object.keys(window.opts).length) {
if (window.opts && Object.keys(window.opts).length !== 0) { return window.opts;
clearInterval(checkInterval); }
resolve(window.opts); await new Promise(resolve => setTimeout(resolve, 100));
} }
}, 100);
});
} }
// Check is hotkey valid // Check is hotkey valid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment