build-your-own-angularjs icon indicating copy to clipboard operation
build-your-own-angularjs copied to clipboard

Wrong reasoning for why `$q.when()` required no extra work to adopt foreign promises

Open prashantpalikhe opened this issue 8 years ago • 0 comments

Notice that we didn’t really have to do anything to make the adoption of foreign Promises work. That’s because our then implementation already knows how to wrap a foreign Promise, and when merely wraps then.

then implementation is not aware of wrapping foreign promise, resolve is.

defer.resolve(value) knows if the value being passed is a thenable (foreing promise) and waits until the foregin promise is resolved before resolving itself.

prashantpalikhe avatar Jul 24 '16 17:07 prashantpalikhe