event

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Sync  = 0
	Async = 1
)
View Source
const (
	BeforeHttpStart      = "http.start.before"
	AfterHttpStart       = "http.start.after"
	BeforeHttpShutdown   = "http.shutdown.before"
	AfterDatabaseConnect = "database.connect.after"
	BeforeRoute          = "route.before"
	AfterRoute           = "route.after"
)

Variables

This section is empty.

Functions

func Has

func Has(eventName string) bool

Has

func Listen

func Listen(eventName string, handler Handler)

Listen

func Register

func Register(eventName string, listener Listener)

Register

func Trigger

func Trigger(eventName string, params interface{})

Trigger

Types

type Event

type Event struct {
	// name
	Name string
	// event params
	Params interface{}
}

Event

type Handler

type Handler func(ev Event)

Handler process event

type Listener

type Listener struct {
	Mode    int
	Handler Handler
}

Listener

Jump to

Keyboard shortcuts

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