domenic / promises-unwrapping

The ES6 promises spec, as per September 2013 TC39 meeting
1.23k stars 94 forks source link

Promise(resolver) vs .then(resolve, reject) #22

Closed johnjbarton closed 10 years ago

johnjbarton commented 10 years ago

As a developer I find the disconnect between the constructor and .then() functions puzzling and annoying.

The constructor take an object as an argument with properties .resolve and .reject; then() takes two arguments called resolve and reject.

Calling the current constructor with a syntax consistent with then() results in a very puzzling runtime error message deep in the Promise library. Definitely not ergonomic.

domenic commented 10 years ago

This repo has always used the two-argument form, so I am not sure what the issue is? https://github.com/domenic/promises-unwrapping#promiseresolver step 9 in particular.

Older DOM promises had a PromiseResolver object, but this repo has always had (resolve, reject).

johnjbarton commented 10 years ago

Oh, sorry. I was using https://github.com/slightlyoff/Promises, I thought it matched this spec.