Closed BairDev closed 8 years ago
Have a look at http://stackoverflow.com/questions/29268569/what-is-the-correct-terminology-for-javascript-promises
Yes, resolution is exactly the substantive for resolving. To resolve a promise, you run the promise resolution procedure with a value x
.
Alright, thanks. I mainly was confused because of two points, both regarding the use of Promises in the AngularJS/$q context.
promise
is an internal slot of the PromiseObject.But anyway, angular.$q might not follow the spec (this spec), then it is not a good example.
The promise resolution procedure is an abstract operation. What this means is that it is a description of some functionality for use within the spec, rather than a function or method that should actually be exposed to users. Some promise implementations do have a function very similar to this one, many do not.
$q.defer().resolve
should internally run the promise resolution procedure with the promise attached to $q.defer()
and the argument you pass to $q.defer().resolve
.
$q.defer().resolve
should actually be called$q.defer().fulfill
. Am I right with this assumption?
No. resolve
does not necessarily fulfill the promise. You can resolve with a rejected promise, leading to a rejection, or you can resolve with a never-settling promise, leading to nothing but the lock-in.
Many thanks for the background stuff. I was not aware of this branch in $q
.
Hi, I don't quite get the meaning of this sentence:
Can this mean something like (Pseudocode):
If this is the case, does this function has anything to do with resolving a promise? To be more precise: what is the meaning of resolution?