Skip to content

Instantly share code, notes, and snippets.

@rmoskal
Last active December 5, 2017 20:36
Show Gist options
  • Save rmoskal/8125eed0b04a4fccc9ad37274e8d4cd7 to your computer and use it in GitHub Desktop.
Save rmoskal/8125eed0b04a4fccc9ad37274e8d4cd7 to your computer and use it in GitHub Desktop.
async_harmful_s3
function functionalWay2() {
fetch('blue')
.then(JSON.parse)
.then(_in =>{
console.log(_in)
return transformFirst(_in)})
.then(sendToClient)
.then(sendResults => remotelog('log',sendResults))
.catch(err => remotelog('error', err))
}
async function declarativeWay() {
try {
let resultsString = await fetch('blue')
let jsonResults=JSON.parse(resultsString)
console.log(jsonResults)
let transformResults= transformFirst(jsonResults)
let sendResults = await sendToClient(transformResults)
remotelog('log', sendResults)
}catch (e) {
remotelog('error', e)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment