Add types for lifecycle events.

Yeah, type is really handy because you can use a map for the handlers.  Otherwise it's a really annoying if/else/else block when you are figuring out which handler to call, and adding new handlers requires extending that block.