Answer the question
In order to leave comments, you need to log in
Async await with a generator?
Help create your own implementation of the async await syntax using Promises and generator functions. If using the standard syntax looks like this:
async function fetchData (id) {
let user = await fetchUser(id),
friends = await fetchFriends(id);
return {
user,
friends
};
}
let fetchData = _async(function* (id) {
let user = (yield fetchUser(id)),
friends = (yield fetchFriends(id));
return {
user,
friends
};
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question