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

>The "hell" rears its head when you need to coordinate multiple such sequences that are running concurrently.

This situation is why I wrote DelayedOp: https://github.com/osuushi/DelayedOp . Of all the little reusable code bits I've written, this one has ended up in more of my projects than any other.

Basically, a DelayedOp is a lightweight manager that runs a callback after its "wait" and "ok" calls have balanced. It ends up being equivalent to _.after(), but it's more natural to use than manually counting your concurrent operations, and it has some conveniences for debugging, so that if a callback never fires, you can find out why.



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

Search: