Skip to content

Commit

Permalink
feat(state): add state
Browse files Browse the repository at this point in the history
  • Loading branch information
godcong committed Sep 20, 2022
1 parent 70d5c58 commit 37274f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ func (f *FSM) CallbackWithState(name string, state uint32, triggerFunc TriggerFu
func (f *FSM) trigger(ctx context.Context, name string, trigger *Trigger) {
t, ok := f.triggers.Get(trigger.stateKey(name))
if ok {
t(ctx, trigger)
t(ctx, name, trigger)
}
t, ok = f.triggers.Get(trigger.key(name))
if ok {
t(ctx, trigger)
t(ctx, name, trigger)
}
}

Expand Down
2 changes: 1 addition & 1 deletion trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
)

type TriggerFunc func(ctx context.Context, trigger *Trigger)
type TriggerFunc func(ctx context.Context, name string, trigger *Trigger)

type Trigger struct {
// From is the state before the transition.
Expand Down

0 comments on commit 37274f3

Please sign in to comment.