Created
September 15, 2017 03:34
-
-
Save oieioi/b6cf0ee88fd8cceb5fb67d56b326a7f9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let asyncFunc = () => new Promise((resolve, reject)=>{ | |
setTimeout(()=>{ | |
resolve() | |
}, 1000); | |
}); | |
let fakeFetch = async (url) =>{ | |
let result = await asyncFunc(url) | |
return `GET ${url} 200 OK` | |
} | |
let main = async () =>{ | |
let apples = await fakeFetch('http://example.com/apples'); | |
let banana = await fakeFetch('http://example.com/bananas'); | |
console.log([apples, banana].join('\r\n')); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment