aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--event/dispatch.go13
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