summaryrefslogtreecommitdiffstats
path: root/js/service
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-18 22:56:44 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-18 22:56:44 +0200
commitded252d29e99e068ea341506129e47a05e053a24 (patch)
treed91167136238df80d6d638c1243bb1aa29058460 /js/service
parent2459002dcc070dcb66b2a44c237b87e8a1b8e968 (diff)
register publisher
Diffstat (limited to 'js/service')
-rw-r--r--js/service/publisher.js24
1 files changed, 9 insertions, 15 deletions
diff --git a/js/service/publisher.js b/js/service/publisher.js
index d7e9bb0e7..db8a1d5db 100644
--- a/js/service/publisher.js
+++ b/js/service/publisher.js
@@ -22,23 +22,17 @@ app.service('Publisher', function () {
};
};
- this.publishAll = function (values) {
- var key;
- for (key in values) {
- if (values.hasOwnProperty(key)) {
- this.publish(values[key]).onChannel(key);
- }
- }
- };
+ this.publishAll = function (data) {
+ var channel,
+ counter;
- this.publish = function (value) {
- return {
- onChannel: function (channel) {
- self.channels[channel].forEach(function (object) {
- object.receive(value);
- });
+ for (channel in data) {
+ if (data.hasOwnProperty(channel)) {
+ for (counter = 0; counter < this.channels[channel].length; counter += 1) {
+ this.channels[channel][counter].receive(data[channel]);
+ }
}
- };
+ }
};
}); \ No newline at end of file