Hacker News new | past | comments | ask | show | jobs | submit login

Didn't ES6 promise ;) to solve this?



I'm awaiting ES7 :D for the true solution to this problem. It'll eliminate the boilerplate of .then(function() {})` entirely. Less brackets, less ceremony.


ES7 was finalized a year ago. Everything except IE 11 supports all of it.

You meant ES2017.

HTH


And all current browsers save IE11 support ES2017 async functions.


Isn't ES6 `.then(()=>{})` ?


Or even without curly braces:

`.then(x => doSomethingWith(x));`


This is true only insofar as libraries use promises, and your code uses promises. They're still pretty annoying in my experience.

There are still some other cases where the mess of brackets is overkill, other than callback hell.


> This is true only insofar as libraries use promises, and your code uses promises. They're still pretty annoying in my experience.

Promisify, or (as I prefer to) just "return new Promise((resolve, reject) => { nonPromisedStuff(...) })"?

> There are still some other cases where the mess of brackets is overkill, other than callback hell.

Like bad coding style?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: