forked from nyaruka/goflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nothing.go
35 lines (26 loc) · 884 Bytes
/
nothing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package waits
import (
"github.com/nyaruka/goflow/flows"
"github.com/nyaruka/goflow/flows/events"
)
func init() {
RegisterType(TypeNothing, func() flows.Wait { return &NothingWait{} })
}
const TypeNothing string = "nothing"
// NothingWait is a wait which waits for nothing.. i.e. a chance for the caller to do
// something and resume immediately
type NothingWait struct {
baseWait
}
// Type returns the type of this wait
func (w *NothingWait) Type() string { return TypeNothing }
// Begin beings waiting at this wait
func (w *NothingWait) Begin(run flows.FlowRun, step flows.Step) {
w.baseWait.Begin(run)
run.ApplyEvent(step, nil, events.NewNothingWait())
}
// CanResume always returns true for a nothing wait because it's not waiting for anything
func (w *NothingWait) CanResume(callerEvents []flows.Event) bool {
return true
}
var _ flows.Wait = (*NothingWait)(nil)