Fixes to work with tedit.

Here are some fixes to make this code work with the tedit project I'm working on.

The main change was enabling all the public APIs to be consumed in continuable style.  Which is a requirement of the git-db interface.

I also remove `setImmediate` since it's not technically needed and doesn't work cross-platform without polyfilling.