slightlyoff / Promises

DOM Promises IDL/polyfill
Apache License 2.0
154 stars 28 forks source link

Renaming accept-fulfill and future-promise in documentation #69

Closed christopherliu closed 11 years ago

christopherliu commented 11 years ago

The current polyfill implementation doesn't match the Readme:

function fetchJSON(filename) {
  // Return a Promise that represents the fetch:
  return new Promise(function(resolver){
    // The resolver is how a Future is satisfied. It has reject(), accept(),
    // and resolve() methods that your code can use to inform listeners with:
    var xhr = new XMLHttpRequest();
    xhr.open("GET", filename, true);
    xhr.send();
    xhr.onreadystatechange = function() {
      if (xhr.readyState == 4) {
        try {
          resolver.accept(JSON.parse(xhr.responseText));
        } catch(e) {
          resolver.reject(e);
        }
      }
    }
  });
}

There is no accept, only fulfill. Also noticed mentions of future not changed to promise. I'm in the middle of coding something now but I'll take a more detailed look at this later and possibly issue a pull.

slightlyoff commented 11 years ago

Good catch.