Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Add explanatory comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnski committed Feb 14, 2022
1 parent f9d0b59 commit f441ee5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,16 @@ async function resolveOnMySkyPortalLogin(): Promise<void> {
// when the login attempt returns an error.
const promise1 = new Promise<void>((resolve, reject) => {
const handleEvent = async ({ key, newValue }: StorageEvent) => {
// We only want the promise to resolve or reject when the right storage
// key is encountered. Any other storage key shouldn't trigger a `resolve`.
if (key !== PORTAL_LOGIN_COMPLETE_SENTINEL_KEY) {
return;
}
// We only want the promise to resolve or reject when the right storage
// key is set, and not removed.
//
// NOTE: We do remove the storage key before setting it in Main MySky,
// because otherwise, setting an already-set key has no effect.
if (!newValue) {
// Key was removed.
return;
Expand Down

0 comments on commit f441ee5

Please sign in to comment.