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

Zoom and Pan: simplify waitForOpts

parent 6163b38a
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -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);
        for (;;) {
            if (window.opts && Object.keys(window.opts).length) {
                return window.opts;
            }
            await new Promise(resolve => setTimeout(resolve, 100));
        }
            }, 100);
        });
    }

    // Check is hotkey valid