summaryrefslogtreecommitdiffstats
path: root/js/service/Publisher.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-19 15:51:26 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-19 15:51:26 +0200
commit11f0246acd0daab1067eb32099fa26f05a26ea21 (patch)
tree67012a66a89be2f43910dee41a6e023d7645b29b /js/service/Publisher.js
parent928ccf49fb5c6deb405358ad38221b0cd205fb6b (diff)
subscribe to more channels and fetch more feeds on init
Diffstat (limited to 'js/service/Publisher.js')
-rw-r--r--js/service/Publisher.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/js/service/Publisher.js b/js/service/Publisher.js
index da9b0a470..784b2fff6 100644
--- a/js/service/Publisher.js
+++ b/js/service/Publisher.js
@@ -15,9 +15,14 @@ app.service('Publisher', function () {
this.subscribe = function (object) {
return {
- toChannel: function (channel) {
- self.channels[channel] = self.channels[channel] || [];
- self.channels[channel].push(object);
+ toChannels: function () {
+ var counter,
+ channel;
+ for (counter = 0; counter < arguments.length; counter += 1) {
+ channel = arguments[counter];
+ self.channels[channel] = self.channels[channel] || [];
+ self.channels[channel].push(object);
+ }
}
};
};
@@ -29,7 +34,7 @@ app.service('Publisher', function () {
for (channel in data) {
if (data.hasOwnProperty(channel) && this.channels[channel] !== undefined) {
for (counter = 0; counter < this.channels[channel].length; counter += 1) {
- this.channels[channel][counter].receive(data[channel]);
+ this.channels[channel][counter].receive(data[channel], channel);
}
}
}