Package lifecycle defines an event for an app's lifecycle.

The app lifecycle consists of moving back and forth between an ordered sequence of stages. For example, being at a stage greater than or equal to StageVisible means that the app is visible on the screen.

A lifecycle event is a change from one stage to another, which crosses every intermediate stage. For example, changing from StageAlive to StageFocused implicitly crosses StageVisible.

Crosses can be in a positive or negative direction. A positive crossing of StageFocused means that the app has gained the focus. A negative crossing means it has lost the focus.

See the package for details on the event model.