One marvelous thing about a promise that distinguishes it from the rest is that it can act as a proxy for another object, not only for local objects but also for a remote object. There are methods that let you confidently employ properties or call functions. All of these exchanges return promises, so that they can be chained.
Here is list of functions you can use as proxies of a promise:
Direct manipulation |
Using a promise as a proxy |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can trim round-trips by using these functions instead of then()
if the promise is a proxy for a remote object.
Even in the case of local objects, these methods can be used as shorthand for particularly-simple gratification...