Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The better JS gets, the more I want to use it. JS with Promises + async/await is now one of my favorite languages.


How do you cancel promises?


You'll need to come up with a better bad-faith "ha gotcha!" than that. That's not even a feature of the promise/future construct in most languages.

But you can google around for some ideas for writing an async pipeline that you need to cancel, like taking some sort of abort/poison object that can be consumed concurrently outside of the pipeline.

For example, https://developer.mozilla.org/en-US/docs/Web/API/AbortContro...


Great response! Yeah, I remember trying to do some parallel jobs with promises some time ago and having to use Sindre's node libraries to have anything remotely useful. Node would leak tons of memory. Not a pleasant experience at all. I feel that as soon as I need to do something interesting, I hit some sort of technical limitation with node and js.




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

Search: