chrootlogin / event

A small event handling system for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Event Handler for GoLang

This can be used to create an event system in your go application

Example

Register event handler

event.Events().On("init-router", func(input ...interface{}) {
  router, ok := input[0].(*gin.Engine)
	if !ok {
		log.Fatal("Can't convert input to gin.Engine.")
	}

	plugins.Registry().RegisterRoutes(router)
})

Emit event and run event handlers

event.Events().Emit("init-router", router)

License

This stuff is licensed under LGPL 3.0.

About

A small event handling system for Go

License:GNU Lesser General Public License v3.0


Languages

Language:Go 100.0%