Skip to content

Commit

Permalink
fix: drop v0 and fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed Jul 5, 2023
1 parent 9b4dd1b commit bc096d5
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 960 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ const (
)

func main() {
f := fsm.New(
f := fsm.NewSafeFsm[MyEvent, MyState](
IsClosed,
fsm.Transforms[MyEvent, MyState]{
fsm.NewTransition([]fsm.Transform[MyEvent, MyState]{
{Event: Open, Src: []MyState{IsClosed}, Dst: IsOpen},
{Event: Close, Src: []MyState{IsOpen}, Dst: IsClosed},
},
}),
)
fmt.Println(f.Current())
err := f.Trigger(Open)
Expand All @@ -97,7 +97,7 @@ func main() {
// closed
// opened
// closed
fmt.Println(fsm.Visualize[MyEvent, MyState](f))
fmt.Println(fsm.VisualizeGraphviz[MyEvent, MyState](f))
// digraph fsm {
// "closed" -> "opened" [ label = "open" ];
// "opened" -> "closed" [ label = "close" ];
Expand Down
195 changes: 0 additions & 195 deletions v0/fsm.go

This file was deleted.

Loading

0 comments on commit bc096d5

Please sign in to comment.