https://github.com/night-codes/events
Golang events library
https://github.com/night-codes/events
Last synced: 11 months ago
JSON representation
Golang events library
- Host: GitHub
- URL: https://github.com/night-codes/events
- Owner: night-codes
- License: wtfpl
- Created: 2018-05-31T22:00:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-26T12:50:33.000Z (about 6 years ago)
- Last Synced: 2025-03-17T13:46:45.978Z (over 1 year ago)
- Language: Go
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Events
Simple golang events library
## Example
```go
package main
import (
"fmt"
"strconv"
"github.com/night-codes/events"
)
var (
myEvent = events.New()
)
func main() {
for i := 0; i < 10; i++ {
l := i
myEvent.On(func(data interface{}) {
fmt.Println("Listener"+strconv.Itoa(l), data)
})
}
for j := 0; j < 10; j++ {
fmt.Println("====== Emit: " + strconv.Itoa(j) + " =====")
myEvent.Emit("Event" + strconv.Itoa(j))
}
}
```
## License
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2018 Oleksiy Chechel
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.