onceevery

package
v0.0.0-...-c0c40a2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2015 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnceEvery

type OnceEvery struct {
	Interval time.Duration
	// contains filtered or unexported fields
}

OnceEvery is an object that will perform exactly one action every given interval.

func New

func New(d time.Duration) *OnceEvery

NewOnceEvery creates a new OnceEvery struct

func (*OnceEvery) Do

func (o *OnceEvery) Do(f func())

Do calls the function f if and only if Do hits the given periodic interval. In other words Do can be called multiple times during the interval but it gets called only once if it hits the interval tick. So if the interval is 10 seconds, and a total of 100 calls are made during this period, f will be called it every 10 seconds.

func (*OnceEvery) Stop

func (o *OnceEvery) Stop()

Stop stops the ticker. No other call made with Do will be called anymore.

Jump to

Keyboard shortcuts

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