Skip to content

Commit

Permalink
chore: lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ozyx committed Oct 30, 2024
1 parent 2b553d2 commit b618817
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,23 @@ const openmct = window.openmct;
function mctItemExists() {
return new Promise((resolve, reject) => {
const startTime = Date.now();

function checkItem() {
if (localStorage.getItem('mct') !== null) {
resolve(true);

return;
}

if (Date.now() - startTime > MAX_POLL_TIME) {
reject(new Error('Timeout waiting for mct localStorage item'));

return;
}

setTimeout(checkItem, POLL_INTERVAL);
}

checkItem();
});
}
Expand Down Expand Up @@ -193,7 +195,7 @@ const openmct = window.openmct;
while (compositionLength === 0 && retryCount < MAX_COMPOSITION_RETRIES) {
composition = await compositionCollection.load();
compositionLength = composition.length;

if (compositionLength === 0) {
retryCount++;
await new Promise(resolve => setTimeout(resolve, COMPOSITION_RETRY_DELAY));
Expand Down

0 comments on commit b618817

Please sign in to comment.