petkaantonov/bluebird — pull request #221 by tadeuzagallo (2014-06-03 04:49:47+00:00)
Title: Implement a tearDown method

Hi,

I just had on my project the necessity of cleaning up some stuff after the whole promise chain have been executed, but it wasn't possible since it is a library, and the users will be able to keep chaining on the promise I will return, so the last promise will be a user's promise, and he would have explicit call a cleanUp method on my API.
So I created this method `tearDown` that receives and stores a unique function that will be called when the chain has finished executing (the `done` method will have to be called, but since it is already advised on the API I thought it would be ok...)

I think it could be helpful on the library as default, if you think so, let me know and I can document it.