timer

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

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

事件

func (*Event) Bind

func (e *Event) Bind(fun func(*EventArg) error) *Event

绑定事件 支持链式绑定 timer.Bind(func1).Bind(func2)

type EventArg

type EventArg struct {
	Sender *Timer
	Msg    string
}

事件回调时回传的参数

type Timer

type Timer struct {
	Elapsed   Event  //达到间隔时的回调
	Name      string //名称
	IsRunning bool   //运行状态
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer(interval int64) *Timer

创建新的实例化对象

func (*Timer) SetInterval

func (obj *Timer) SetInterval(interval int64) error

设置执行间隔

func (*Timer) SetName

func (obj *Timer) SetName(name string) *Timer

设置定时器的名称

func (*Timer) Start

func (obj *Timer) Start()

开始计时器 需要通过 NewTimer 方法获取实例化

func (*Timer) Stop

func (obj *Timer) Stop()

停止计时器

func (*Timer) UseLogger

func (obj *Timer) UseLogger(logger logger.Logger) *Timer

设置日志

Jump to

Keyboard shortcuts

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