310x Filetype PDF File size 0.66 MB Source: cs.gmu.edu
Backend Development
SWE 432, Fall 2019
Web Application Development
Review: Async Programming Example
Go get a Go get a Go get a Go get a Go get a
candy bar candy bar candy bar candy bar candy bar
Go get a Go get a Go get a Go get a Go get a
1 second eachcandy bar candy bar candy bar candy bar candy bar
thenCombine
Group all Twix Group all 3 Group all Group all Group all
Musketeers MilkyWay MilkyWay Dark Snickers
2 seconds each when done
Eat all the
Twix
Explain
example
LaToza GMU SWE 432 Fall 2019 !2
Review: Async/Await
• Rules of the road:
• You can only call await from a function that is
async
• You can only await on functions that return a
Promise
• Beware: await makes your code synchronous!
async function getAndGroupStuff() {
...
ts = await lib.groupPromise(stuff,"t");
...
}
LaToza GMU SWE 432 Fall 2019 !3
Logistics
• HW2 released
• Due 10/7 before class
LaToza GMU SWE 432 Fall 2019 !4
no reviews yet
Please Login to review.