From 044db5bee8e963e64ecb057b617781e84f06203f Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Fri, 21 Nov 2014 18:01:24 -0800 Subject: [PATCH] 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 --- .../src/github.com/tuxychandru/pubsub/pubsub.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Godeps/_workspace/src/github.com/tuxychandru/pubsub/pubsub.go b/Godeps/_workspace/src/github.com/tuxychandru/pubsub/pubsub.go index 9cbf9cffa..aac7ad89f 100644 --- a/Godeps/_workspace/src/github.com/tuxychandru/pubsub/pubsub.go +++ b/Godeps/_workspace/src/github.com/tuxychandru/pubsub/pubsub.go @@ -66,6 +66,14 @@ func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) { ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch} } +// AddSubOnce adds one-time subscriptions to an existing channel. +// For each topic, a message will be sent once. +func (ps *PubSub) AddSubOnce(ch chan interface{}, topics ...string) { + for _, t := range topics { + ps.cmdChan <- cmd{op: subOnce, topics: []string{t}, ch: ch} + } +} + // Pub publishes the given message to all subscribers of // the specified topics. func (ps *PubSub) Pub(msg interface{}, topics ...string) {