Skip to content

Commit

Permalink
Zoom and Pan: simplify waitForOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Jun 5, 2023
1 parent 6163b38 commit 2d4c66f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions extensions-builtin/canvas-zoom-and-pan/javascript/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d4c66f

Please sign in to comment.