clock

package
v0.1.6-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	// The TargetID will be automatically removed after Timeout duration, if not zero.
	// The timer starts when the delete button is rendered.
	Timeout time.Duration

	// The optional ticker step, 1s by default
	// Ignored if 0 or greater than the timeout
	TickerStep time.Duration

	// The function to call at every ticker step. Set nil to ignore ticker.
	// TODO: clock - make tic a parameter of Start
	Tic func(*Clock)
	// contains filtered or unexported fields
}

Clock provides a timer and a ticker with possibility to add callback functions at every tic and at the end of the timer.

func (*Clock) Start

func (_clock *Clock) Start(_finished func())

Start starts the timer and the ticker, according to Timeout and TickerStep properties.

func (*Clock) StartTime

func (_clock *Clock) StartTime() time.Time

StartTime returns the last countdown start time. Can be a Zero time if the clock has never been started.

func (*Clock) Stop

func (_clock *Clock) Stop()

Stop stops the ticker and the timer.

func (*Clock) TimeLeft

func (_clock *Clock) TimeLeft() time.Duration

Timeleft returns the time left before the end of the timer, or zero if the clock is not started.

Jump to

Keyboard shortcuts

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