![]() ![]() In concurrentStart, both timers are created and then awaited. Second timer is not created until the first has already fired, so the code finishes In sequentialStart, execution suspends 2 seconds for the firstĪwait, and then another second for the second await. Function foo ( ) sequentialStart ( ) // after 2 seconds, logs "slow", then after 1 more second, "fast" // wait above to finish setTimeout (concurrentStart, 4000 ) // after 2 seconds, logs "slow" and then "fast" // wait again setTimeout (concurrentPromise, 7000 ) // same as concurrentStart // wait again setTimeout (parallel, 10000 ) // truly parallel: after 1 second, logs "fast", then after 1 more second, "slow" await and parallelism
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |