boomer

package module
v0.0.0-...-b551789 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2016 License: MIT Imports: 2 Imported by: 2

README

Go Report

boomer

Mdviewer logo

Boomer set a count down timer and trigger a function when timeout.

Example

Run the example under directory example to figure out what this repo can do.

go get github.com/zyfdegh/boomer
git clone https://github.com/zyfdegh/boomer.git
cd boomer/example
go build
./example

[zyfdegh/gotty][https://github.com/zyfdegh/gotty.git]: A forked gotty from [yudai/gotty][https://github.com/yudai/gotty.git].

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boomer

type Boomer struct {
	SECONDS_INIT uint64
	// contains filtered or unexported fields
}

Boomer is a count down timer and can trigger function `f` when timeout.

func NewBoomer

func NewBoomer(seconds uint64, f interface{}) (*Boomer, error)

NewBoomer creates a boomer, time is in seconds. You need to define function f.

func (*Boomer) Arm

func (p *Boomer) Arm()

Arm let timer count down now.

func (*Boomer) Rewind

func (p *Boomer) Rewind() error

Rewind count down timer to initial value(defined when you call Arm()).

func (*Boomer) Unarm

func (p *Boomer) Unarm()

Unarm cancels timer, the boomer will no longer boom.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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