Documentation ¶
Overview ¶
Package timerstack provides a timer which can execute multiple delayed functions one after one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action func() bool
Action is the function being executed. If the function returns false, the timer stack stops executing after this function.
type TimerStack ¶
type TimerStack struct {
// contains filtered or unexported fields
}
TimerStack allows to stack multiple timers on top to be executed one after one.
func (*TimerStack) After ¶
func (ts *TimerStack) After(d time.Duration, a Action) *TimerStack
After adds a new timer to the stack which is executed after the given time delay after the last executed timer. On execution, a is executed. If this function returns false, the execution stops after this function.
func (*TimerStack) RunBlocking ¶
func (ts *TimerStack) RunBlocking()
RunBlocking starts the timer queue blocking the current go-routine until all timers on the stack are executed or until the timer has been stoped.