程序代写 ASYNCHRONOUS PROGRAMMING – cscodehelp代写
ASYNCHRONOUS PROGRAMMING
Andrew College Boston University
WHAT IS A PROMISE?
Copyright By cscodehelp代写 加微信 cscodehelp
A Promise is a proxy for a value not
necessarily known when the promise is created.
A promise represents WORK that needs to be done at some point.
You can use it everywhere but not with Internet Explorer.
EVERYWHERE
Synchronous
One expression at a time.
Asynchronous
The next expression runs while the previous finishes up.
DIFFERENCES
STANDARD EXAMPLE
THEN() – CAN BE USED MULTIPLE TIMES
Every use of .then() will
that you can use again.
CHAINING PROMISES
PROMISE.ALL()
PROMISE.ALL()
The all() method takes an iterable of promises as input, and returns a single Promise that resolves to an array of the results of the input promises, in order.
RACE() – WAIT UNTIL ANY PROMISE WORKS OR FAILS
CATCHING ERRORS
The catch() returns a Promise.
Deals w/rejected cases only.
CATCH() IS JUST A FORM OF THEN()
The catch() is just like then() without a callback function for success.
METHODS YOU NEED TO UNDERSTAND
程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com