Examples of Promis

The Promise capture and reject exception

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Wrong sample

 

 

 

 

 

 

 

 

 

 

 

Exception/Reject in Promise.all

 

 

                  

 

 

 

After plurality Promise.all resolve, to give a promise to resolve Last

 

 

                    

 

 

 

 

More Promise.all, catch all the reject promise.all

 

 

                    

 

 

   

 

Sequentially performing a plurality of functions of asynchronous Promise

 

 -----------------------------------------------------------------------------------------------

 

 

 

 

 

Catch monitor multiple asynchronous error function

 

 ----------------------------------------

 

 

      

 

 -----------------------------------------------------

 

 

 

 

reject listen to multiple asynchronous function error

 

 --------------------------------------------------------------------------------------

 

 

 

 

 ----------------------------------------------------------------------------------------------------

 

 

 

 

Promise.Resolve 

 

 

fun1 itself is a promis

console results

 

 

   

 

 

 

 

fun1 not promise

 

console results

 

 

 fun1 not promise, can not answer then  

 

 

 

 


 

 

 

 

 

Error usage,

Such resolve () function can not be performed within the

 

 

 ---------------------------------------------------------------

 

 

 

 

 ----------------------------------------------------

 

 

Guess you like

Origin www.cnblogs.com/crdanding/p/12182809.html