hotfix(dep) duplicates TEMP DONT MERGE TO MASTER
before merging, fork and send a PR to tuxy License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Nov 21, 2014 at 18:01 UTC
044db5bee8e963e64ecb057b617781e84f06203f
1 file changed
+8
Godeps/_workspace/src/github.com/tuxychandru/pubsub/pubsub.go
+8
@@ -66,6 +66,14 @@ func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) {
66
ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch}
67
}
68
69
+// AddSubOnce adds one-time subscriptions to an existing channel.
70
+// For each topic, a message will be sent once.
71
+func (ps *PubSub) AddSubOnce(ch chan interface{}, topics ...string) {
72
+ for _, t := range topics {
73
+ ps.cmdChan <- cmd{op: subOnce, topics: []string{t}, ch: ch}
74
+ }
75
+}
76
+
77
// Pub publishes the given message to all subscribers of
78
// the specified topics.
79
func (ps *PubSub) Pub(msg interface{}, topics ...string) {