https://github.com/deatil/go-events
go-events is a go event and event'subscribe pkg, like wordpress hook functions
https://github.com/deatil/go-events
event events go-event go-events go-hook hook listen wordpress
Last synced: 5 months ago
JSON representation
go-events is a go event and event'subscribe pkg, like wordpress hook functions
- Host: GitHub
- URL: https://github.com/deatil/go-events
- Owner: deatil
- License: apache-2.0
- Created: 2024-06-13T09:26:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-04T03:07:16.000Z (10 months ago)
- Last Synced: 2025-03-31T08:06:59.609Z (6 months ago)
- Topics: event, events, go-event, go-events, go-hook, hook, listen, wordpress
- Language: Go
- Homepage: https://pkg.go.dev/github.com/deatil/go-events
- Size: 71.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## go-events
### Desc
* go-events is a go event and event'subscribe pkg, like wordpress hook functions.
[中文](README_CN.md) | English
### Download
~~~go
go get -u github.com/deatil/go-events
~~~### Get Starting
~~~go
package mainimport (
"fmt"
"github.com/deatil/go-events/events"
)func main() {
// use action
events.AddAction("test1", func() {
fmt.Println("test1")
}, events.DefaultSort)events.DoAction("test1")
// use Filter
events.AddFilter("test1", func(val string) string {
return "run test1 => " + val
}, events.DefaultSort)data1 := "init1"
test := events.ApplyFilters("test1", data1)fmt.Println(test)
// output: run test1 => init1
}~~~
### LICENSE
* The library LICENSE is `Apache2`, using the library need keep the LICENSE.
### Copyright
* Copyright deatil(https://github.com/deatil).