timer

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	Count    int // 执行次数
	ExecTime int // 执行时间
	// contains filtered or unexported fields
}

type Timer

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

func NewTimer

func NewTimer(interval time.Duration) *Timer

New 创建定时器

func (*Timer) AddTimer

func (tw *Timer) AddTimer(delay time.Duration, count int, cb func(*Timer)) int

AddTimer 添加定时器 key为定时器唯一标识

func (*Timer) RemoveTimer

func (tw *Timer) RemoveTimer(key int)

RemoveTimer 删除定时器 key为添加定时器时传递的定时器唯一标识

func (*Timer) Start

func (tw *Timer) Start()

Start

func (*Timer) Stop

func (tw *Timer) Stop()

Stop

Jump to

Keyboard shortcuts

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