timer

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 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) IsCancelled added in v0.4.11

func (t *Timer) IsCancelled() bool

IsCancelled returns true if the timer is cancelled

func (*Timer) IsCompleted added in v0.4.11

func (t *Timer) IsCompleted() bool

IsCompleted returns true if the timer is completed

func (*Timer) Reset

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

Reset resets the timer with a new duration

func (*Timer) SetCancelled added in v0.4.11

func (t *Timer) SetCancelled(cancelled bool)

SetCancelled sets the cancelled flag

func (*Timer) SetCompleted added in v0.4.11

func (t *Timer) SetCompleted(completed bool)

SetCompleted sets the completed flag

Jump to

Keyboard shortcuts

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