https://github.com/chrootlogin/event
A small event handling system for Go
https://github.com/chrootlogin/event
events go golang
Last synced: 25 days ago
JSON representation
A small event handling system for Go
- Host: GitHub
- URL: https://github.com/chrootlogin/event
- Owner: chrootlogin
- License: lgpl-3.0
- Created: 2018-08-18T16:17:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-29T09:58:28.000Z (almost 8 years ago)
- Last Synced: 2024-05-02T04:52:22.530Z (about 2 years ago)
- Topics: events, go, golang
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.