timedoff

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 4 Imported by: 4

README

main Go Reference

Resettable, concurrency-safe, auto-off time.Timer. See timedoff_test.go for an example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackT

type CallbackT struct {
	Callback func(interface{})
	Params   interface{}
}

type TimedOff

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

TimedOff is an object that can be used as a generic atomic on/off switch that automatically turns itself off after a specified time. Similar to a time.Timer object but built for concurrent use.

func New

func New(duration time.Duration, cb ...*CallbackT) *TimedOff

New creates a TimedOff object with a 5s duration by default.

func (*TimedOff) IsOn

func (t *TimedOff) IsOn() bool

func (*TimedOff) Off

func (t *TimedOff) Off()

func (*TimedOff) On

func (t *TimedOff) On()

On resets the internal timer.

Jump to

Keyboard shortcuts

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