- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Fri, 12 Apr 2013 11:10:40 -0700
- To: Domenic Denicola <domenic@domenicdenicola.com>
- Cc: Brandon Wallace <brandon.wallace@yahoo.com>, "www-dom@w3.org" <www-dom@w3.org>
On Thu, Apr 11, 2013 at 4:57 PM, Domenic Denicola <domenic@domenicdenicola.com> wrote: > The conventional name for these two methods would be Future.resolve and Future.reject. The implementation would be > > Future.resolve = (x) => new Future(({ resolve }) => resolve(x)); > > Future.reject = (reason) => new Future(({ reject }) => reject(reason)); > > This has the added benefit of using "resolve" semantics, i.e. assimilating thenables (including existing promises on the web, like jQuery promises). Now that I've actually learned the difference between accept() and resolve(), I'd prefer that all three of the resolution methods exist as statics on the Future interface. You don't always want resolve semantics. ~TJ
Received on Friday, 12 April 2013 18:11:27 UTC