timer

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timer

type Timer struct {
	Cancelled bool
	Completed bool
	// contains filtered or unexported fields
}

Timer is a struct for a timer

func NewTimer

func NewTimer(duration time.Duration, complete func()) *Timer

NewTimer creates a new timer with a duration and a callback function that is called when the timer is expired

func (*Timer) Cancel

func (t *Timer) Cancel()

Cancel cancels the timer

func (*Timer) Reset

func (t *Timer) Reset(duration time.Duration)

Reset resets the timer with a new duration

Jump to

Keyboard shortcuts

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