Added an example of how to use the flow

This commit is contained in:
Sasha Koshka
2023-01-12 15:33:50 -05:00
parent 0f9153e496
commit 9710e57b2b
2 changed files with 112 additions and 0 deletions

View File

@@ -25,6 +25,14 @@ func (flow Flow) Switch (stage string) {
stageCallback()
}
// SwitchFunc returns a function that calles Switch with the specfied stage
// name. This is useful for creating callbacks.
func (flow Flow) SwitchFunc (stage string) (callback func ()) {
return func () {
flow.Switch(stage)
}
}
// Stage returns the name of the current stage the flow is on.
func (flow Flow) Stage () (name string) {
return flow.stage