Tracks the state of a stack, and raises events when it changes.