event

package
v0.0.0-...-b03bf0d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndEvent

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

结束事件,实现了Event接口

func (EndEvent) Content

func (e EndEvent) Content() string

func (EndEvent) EventType

func (e EndEvent) EventType() Type

type Event

type Event interface {
	EventType() Type
	Content() string
}

事件抽象接口

func OfEnd

func OfEnd() Event

End类型Event的工厂方法

func OfStart

func OfStart() Event

第二种实现方式,分别给Start和End类型的Event单独提供一个工厂方法 Start类型Event的工厂方法

type Factory

type Factory struct{}

第一种实现方式,为Event提供一个工厂对象 事件工厂对象

func (*Factory) Create

func (e *Factory) Create(etype Type) Event

更具事件类型创建具体事件

type StartEvent

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

开始事件,实现了Event接口

func (StartEvent) Content

func (s StartEvent) Content() string

func (StartEvent) EventType

func (s StartEvent) EventType() Type

type Type

type Type uint8
const (
	Start Type = iota
	End
)

事件类型定义

Jump to

Keyboard shortcuts

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