Created
March 12, 2017 19:11
-
-
Save mightyguava/4e5cbdea9e98fc8b8f1f854fa2f3bcb8 to your computer and use it in GitHub Desktop.
Demystifying Async Programming in Javascript - fetchJson async await
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function () { | |
var user = await fetchJson('/api/user/self'); | |
var interests = await fetchJson('/api/user/interests?userId=' + self.id); | |
var recommendations = await Promise.all( | |
interests.map(i => fetchJson('/api/recommendations?topic=' + i))); | |
render(user, interests, recommendations); | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you want
user
instead ofself
in line 3