Skip to content

Async versus sync callbacks #14

Open
@ryantrinkle

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions