Futures

Anne van Kesteren annevk at annevk.nl
Fri Apr 26 11:46:30 PDT 2013


On Fri, Apr 26, 2013 at 7:25 PM, Kevin Smith <zenparsing at gmail.com> wrote:
>     Future.accept(Future.resolve(1)).then(value => {
>
>         console.log(value !== 1);
>         return Future.accept(Future.resolve(1));
>
>     }).then(value => {
>
>         console.log(value === 1);
>     });
>
> logs
>
> - true
> - true
>
> Is that what it should be doing, according to the DOM spec?  Anne, Alex?

No. Per the definition of the then() method and
http://dom.spec.whatwg.org/#concept-future-wrapper-callback then()
will just be invoked with the result of the future. Future.accept()
sets the result of the new future to the argument it was passed.
Future.resolve() sets the result of the future to the resolved value
(does unwrapping of a thenable).


--
http://annevankesteren.nl/


More information about the es-discuss mailing list