More on Transitions
There are multiple kinds of transitions:
- Internal
- External
- Eventless
- Forbidden
Internal transitions
do not execute and actions on parent state node
entry
exit
{
states: {
ready: {
on: {
GO_TO_A: {
target: ".a",
},
GO_TO_B: {
target: ".b",
},
GO_TO_C: {
target: ".c",
},
},
states: {
a: {},
b: {},
c: {},
},
},
},
}Use dots for internal transitions
External transitions
do execute and actions on parent state node
entry
exit
{
states: {
a: {
id: "a",
on: {
GO_TO_B: {
target: "b",
},
},
},
b: {
on: {
GO_TO_A: {
target: "#a",
},
},
},
},
}Use plain names or IDs for external transitions
Eventless transitions
can happen on state entry
{
states: {
ready: {
always: [
{
target: "foo",
cond: "someGuard"
},
{
target: "bar"
}
]
},
foo: {},
bar: {}
},
}Use special property for eventless transitions
always
Forbidden transitions
way of defining that some transitions take place
cannot
explicit
{
states: {
ready: {
on: {
EVENT: undefined
},
},
},
}
coding time!
6. More on transitions
By Kuba Skoneczny
6. More on transitions
- 161