This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21635 - "resolve" in Future example should probably be "resolver"
Summary: "resolve" in Future example should probably be "resolver"
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-09 09:15 UTC by Harald Alvestrand
Modified: 2013-04-09 09:27 UTC (History)
2 users (show)

See Also:


Attachments

Description Harald Alvestrand 2013-04-09 09:15:30 UTC
From the example:

    xhr.onload = function() {
      if(xhr.response)
        resolver.resolve(xhr.response)
      resolve.reject(new DOMError("JSONError"))
    }
    xhr.onloadend = function() { resolver.reject(new DOMError("NetworkError")) }
  })

If "resolve" in line 4 is "resolver", I think I understand this.

BTW: The idiom of "reject does nothing if resolver.resolve succeeded" wasn't obvious to me until the third reading; it might be reader-friendly to add a comment about this.