Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pocke/goevent
goevent is event dispatcher written by golang.
https://github.com/pocke/goevent
Last synced: about 2 months ago
JSON representation
goevent is event dispatcher written by golang.
- Host: GitHub
- URL: https://github.com/pocke/goevent
- Owner: pocke
- License: mit
- Created: 2015-01-06T14:05:18.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-17T10:59:31.000Z (almost 10 years ago)
- Last Synced: 2024-06-20T11:13:21.334Z (6 months ago)
- Language: Go
- Homepage:
- Size: 223 KB
- Stars: 13
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/pocke/goevent.svg?branch=master)](https://travis-ci.org/pocke/goevent)
[![Coverage Status](https://img.shields.io/coveralls/pocke/goevent.svg)](https://coveralls.io/r/pocke/goevent)
[![GoDoc](https://godoc.org/github.com/pocke/goevent?status.svg)](https://godoc.org/github.com/pocke/goevent)goevent
===============goevent is event dispatcher written by golang.
example
===========listen for event
-----------------```go
e := goevent.New()
e.On(func(i int, s string){
fmt.Printf("%d: %s\n", i, s)
})
```Trigger
----------```go
e.Trigger(1, "foo")
```Use event table
----------------```go
table := goevent.NewTable()
table.On("foo", func(i int){
fmt.Printf("foo: %d\n", i)
})
table.On("bar", func(s string){
fmt.Printf("bar: %s\n", s)
})table.Trigger("foo", 1)
table.Trigger("bar", "hoge")
table.Trigger("bar", 38) // retrun error
```LICENSE
-----------Copyright © 2015 pocke
Licensed [MIT][mit]
[MIT]: http://www.opensource.org/licenses/mit-license.php