diff options
| author | faiface <faiface@ksp.sk> | 2017-08-19 22:55:04 +0200 |
|---|---|---|
| committer | faiface <faiface@ksp.sk> | 2017-08-19 22:55:04 +0200 |
| commit | da7dd2592bde478c399af2099c32ebcb6280d956 (patch) | |
| tree | 3cf69ce686a70f6e5c8319ec28df625806335fa7 | |
| parent | ff67872ad765401311b24f24713fc78554e4d63c (diff) | |
| download | gui-da7dd2592bde478c399af2099c32ebcb6280d956.zip | |
event: add Sprint
| -rw-r--r-- | event/dispatch.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/event/dispatch.go b/event/dispatch.go index 41247b0..6fe0102 100644 --- a/event/dispatch.go +++ b/event/dispatch.go @@ -1,12 +1,25 @@ package event import ( + "bytes" + "fmt" "strings" "sync" ) const Sep = "/" +func Sprint(a ...interface{}) string { + var buf bytes.Buffer + for i := range a { + if i > 0 { + buf.WriteString(Sep) + } + fmt.Fprint(&buf, a[i]) + } + return buf.String() +} + type Dispatch struct { mu sync.Mutex handlers []func(event string) bool |