timer

package
v0.0.0-...-d853fe5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIN_TIMER_INTERVAL = 1 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFunc

type CallbackFunc func()

CallbackFunc Type of callback function

type Timer

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

func (*Timer) AddCallback

func (t *Timer) AddCallback(d time.Duration, callback CallbackFunc) *timer

Add a callback which will be called after specified duration

func (*Timer) AddTimer

func (t *Timer) AddTimer(d time.Duration, callback TimerCallbackFunc) *timer

Add a timer which calls callback periodly

func (*Timer) Init

func (t *Timer) Init()

func (*Timer) StartTicks

func (t *Timer) StartTicks(tickInterval time.Duration)

Start the self-ticking routine, which ticks per tickInterval

func (*Timer) Tick

func (t *Timer) Tick()

Tick once for timers

type TimerCallbackFunc

type TimerCallbackFunc func() bool

TimerCallbackFunc Type of callback function, return false represent stop this timer

Jump to

Keyboard shortcuts

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