Skip to content
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

Async versus sync callbacks #14

Open
ryantrinkle opened this issue Oct 13, 2019 · 0 comments
Open

Async versus sync callbacks #14

ryantrinkle opened this issue Oct 13, 2019 · 0 comments

Comments

@ryantrinkle
Copy link

ryantrinkle commented Oct 13, 2019

I just ran into an issue where readystatechange being async caused some trouble. Specifically:

  1. The XHR changed to readystate 2, then 3, then 4.
  2. As a result, 3 callbacks got enqueued
  3. Then, all 3 callbacks got processed
  4. Since the readystate had already changed to 4, all 3 callbacks saw readystate 4, and all 4 reported that the XHR had just finished.

This behavior doesn't seem right, but I'm not clear on how the decision ought to be made between sync and async for this sort of thing.

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

No branches or pull requests

1 participant