ticker

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyStopped = errors.New("Already stopped")

ErrAlreadyStopped is returned if this service was already stopped and Stop() is called again

Functions

This section is empty.

Types

type Config

type Config struct {
	Clock    clock.Clock
	Interval time.Duration
	Callback func()
}

Config defines the necessary information and dependencies to instantiate a Ticker

type Ticker

type Ticker struct {
	// contains filtered or unexported fields
}

Ticker represents a periodic timer that invokes a callback

func New

func New(config *Config) *Ticker

New builds a ticker that will call the given callback function periodically

func (*Ticker) Stop

func (tk *Ticker) Stop() error

Stop stops the timer and releases the goroutine running it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL