Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FSM ¶
type FSM struct {
// contains filtered or unexported fields
}
func NewFSM ¶
func NewFSM(transitions Transitions, callbacks Callbacks) (*FSM, error)
NewFSM create a new FSM object then registers transitions and callbacks to it
func (*FSM) SendEvent ¶
SendEvent triggers a callback with an event, and do transition after callback if need There are 3 types of callback:
- on exit callback: call when fsm leave one state, with ExitEvent event
- event callback: call when user trigger a user-defined event
- on entry callback: call when fsm enter one state, with EntryEvent event
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is a thread-safe structure that represents the state of a object and it can be used for FSM
type Transition ¶
Transition defines a transition that a Event is triggered at From state, and transfer to To state after the Event
type Transitions ¶
type Transitions []Transition
Click to show internal directories.
Click to hide internal directories.