Skip to content

clear interval when user manually closes oauth window #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

pilagod
Copy link
Contributor

@pilagod pilagod commented Jun 21, 2018

When user closes the popup window before oauth process finishing, the time interval is still running in the background.

I add an "else if" statement to check popup window state only after the normal path, this new logic branch will not be touched if oauth finishes properly (success or failure).

@matthewmueller
Copy link
Member

matthewmueller commented Jun 21, 2018

Good catch! Does it also work if it's a bit higher up?

Thinking something like this:

var intervalId = setInterval(function polling() {
  if (popup.closed) {
    clearInterval(intervalId)
    return
  }

  // ... everything else
})

@pilagod
Copy link
Contributor Author

pilagod commented Jun 21, 2018

Yes, you're right ! I found that there are only two possible ways to close the popup:

(1) Oauth finishes
(2) Manually close

I will lift it up for better code readability 😃

@matthewmueller matthewmueller merged commit cd74f54 into lapwinglabs:master Jun 21, 2018
@matthewmueller
Copy link
Member

Cool – thanks bud :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants