timer

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIKER_INTERVAL_MS = 500
)

Variables

View Source
var (
	RepeatForever = -1 //重复执行
	RepeatDone    = 0  //执行完毕
	RepeatOnce    = 1  //执行一次
)

Functions

func KillTimer

func KillTimer(this interface{}, id int)

停止定时任务

func SetTimer

func SetTimer(this interface{}, id int, elapse int, repeat int, param interface{}) bool

设置定时任务 this 实现OnTimer接口的对象指针 id 定时任务ID elapse 执行间隔时间(最小单位:毫秒) repeat 重复次数(-1表示重复执行,大于0则表示执行具体次数) param 定时任务附带参数(尽量不要传递对象指针)

Types

type ITimer

type ITimer interface {
	//定时任务执行接口
	OnTimer(id int, param interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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