farmdawgnation/vain — pull request #11 by farmdawgnation (2014-07-27 15:01:35+00:00)
Title: Call Me Maybe: Work on refactoring vain to allow snippets to behave asynchronously.

![telephone](http://4.bp.blogspot.com/_kQrgwGnPaP8/TKIzSAoD7BI/AAAAAAAAB-I/G5j8of50_OU/s1600/Phone.jpg)

The biggest shortcoming in vain to date is the fact that snippets didn't support asynchronous operations. They had to work synchronously on the nodes they were provided. This branch is work towards changing that in the next release. Specifically,

* `render` and `renderFile` now require a callback or they throw an error. I tried to use `fibers` to avoid it, but I think I misunderstood their purpose when I did so. lulz.
* Snippets are now processed using an event emitter.
* Snippets have an additional callback (called `finished` in my tests) that must be executed when they're done and its time for the next snippet to be invoked. They can also pass some error state into this function which causes execution to halt and the renderer to throw an error.