ticker

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

README

ticker

This package implements a ticker that can be stopped and re-started.

Install with go get github.com/megabild/ticker.

Browse the package documentation at http://godoc.org/github.com/megabild/ticker.

Thanks to tiagoq@gmail.com

Documentation

Overview

Package ticker implements a ticker that can be stopped and re-started.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ticker

type Ticker interface {
	// Start (re-)starts the ticker. Ticks will be delivered on the ticker's
	// channel until Stop is called.
	Start()
	// StartAndRun (re-)starts the ticker. Ticks will be delivered on the ticker's
	// channel until Stop is called. The Tick function is called instantly
	StartAndRun()
	// Stop stops the ticker. No ticks will be delivered on the ticker's channel
	// after Stop returns and before Start is called again.
	Stop()
	// Stopped returns whether the ticker is stopped.
	Stopped() bool
}

func New

func New(d time.Duration, f func()) Ticker

New returns a new ticker that ticks every d seconds. It adjusts the intervals or drops ticks to make up for slow receivers. The ticker is initially in the stopped state.

Jump to

Keyboard shortcuts

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