3 ms·
Promises & named functions are your friends! So you can do stuff like this: callToRemoteApi().then(processData) .then(makeAnotherCallToAnotherApi) .
by Bahamut 13y ago
Promises & named functions are your friends!
So you can do stuff like this:
callToRemoteApi().then(processData)
.then(makeAnotherCallToAnotherApi)
.then(processAllTheData)
- camus2 13y agoYou still need to write functions ,that's the issue. => functions will make things a bit better,but await and generator syntax are the key to solve some issues.
- esailija 13y agoGenerators and await don't really give anything substantial after promises except less superficially verbose syntax and not even that when using CoffeeScript where `return` and `function(){}` are really light-weight. Actually what issues generators and await solve are same as what CoffeeScript "solves". Although with generators you "can use normal control flow constructs". Except in most cases you probably use map or forEach instead of loops anyway. And try-catch is really broken.