Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures Start.
type Stopper ¶
type Stopper interface {
Stop() // Stops a periodic task.
}
Stopper implements the Stop method, which stops a periodic task from Start().
func Start ¶
func Start(ctx context.Context, interval time.Duration, callback func(Tick), options ...Option) Stopper
Start starts a periodic task with a ticker at the specified interval, which executes the given callback after each tick. Pending tasks do not overlap, but could start immediately if the previous task(s) takes longer than the interval. Call Stop() on the return value in order to stop the ticker and to release associated resources. The interval must be greater than zero.
Click to show internal directories.
Click to hide internal directories.