-
Notifications
You must be signed in to change notification settings - Fork 6
Substate Support
NStateManager supports hierarchical states (i.e. substates). If you're not familiar with substates, think of a telephone that can be OnHook, OffHook, or OnHold. OnHold is actually a substate of Offhook since the telephone must be off the hook in order to be placed on hold.
TODO: graphic
When using substates, it's important to understand how state change actions are affected. Keeping with the telephone example, when moving from OnHook to OffHook, the actions will execute as they do when not using substates
1. OnHook exit action
2. OffHook entry action
When moving from OffHook to OnHold, you can start seeing the effect of substates. The exit action for OffHook will not execute since we're not exiting the OffHook state. The only state action executed is the OnHold entry action. Similarly, when taken off hold, the OnHold exit action will execute, but not the OffHook entry action since we still haven't left the OffHook state.
What do you think happens if we hang up while on hold? Here's what will happen.
1. OnHold exit action
2. OffHook exit action
3. OnHook entry action
TODO