Add types for lifecycle events.

I'd be fine with a type internally, but it shouldn't be part of the API.