- From: Marius Gundersen <notifications@github.com>
- Date: Wed, 15 Apr 2015 13:09:24 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
Received on Wednesday, 15 April 2015 20:09:54 UTC
BTW, this would work pretty well with async/await:
```js
async function ajax(url){
showSpinner();
try{
const r = await fetch(url);
const json = await r.json();
await displayData(json);
}catch(e)
showError(e);
}finally{
hideSpinner();
}
}
var p = ajax('/test')
setTimeout(() => p.cancel(), 100);
```
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-93551499
Received on Wednesday, 15 April 2015 20:09:54 UTC