summaryrefslogtreecommitdiffstats
path: root/coffee/lib/services/publisher.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'coffee/lib/services/publisher.coffee')
-rw-r--r--coffee/lib/services/publisher.coffee74
1 files changed, 37 insertions, 37 deletions
diff --git a/coffee/lib/services/publisher.coffee b/coffee/lib/services/publisher.coffee
index 4d8788726..39d4ddd43 100644
--- a/coffee/lib/services/publisher.coffee
+++ b/coffee/lib/services/publisher.coffee
@@ -15,40 +15,40 @@
angular.module('OC').factory '_Publisher', ->
- class Publisher
-
- constructor: ->
- @subscriptions = {}
-
-
- # Use this to subscribe to a certain hashkey in the returned json data
- # dictionary.
- # If you send JSON from the server, you'll receive something like this
- #
- # {
- # data: {
- # modelName: {
- # create: [{id: 1, name: 'john'}, {id: 2, name: 'ron'}],
- # update: [],
- # delete: []
- # }
- # }
- # }
- #
- # To get the array ['one', 'two'] passed to your model, just subscribe
- # to the key:
- # Publisher.subscribeModelTo('modelName', myModelInstance)
- #
- subscribeModelTo: (model, name) ->
- @subscriptions[name] or= []
- @subscriptions[name].push(model)
-
-
- # This will publish data from the server to all registered subscribers
- # The parameter 'name' is the name under which subscribers have registered
- publishDataTo: (data, name) ->
- for subscriber in @subscriptions[name] || []
- subscriber.handle(data)
-
-
- return Publisher \ No newline at end of file
+ class Publisher
+
+ constructor: ->
+ @subscriptions = {}
+
+
+ # Use this to subscribe to a certain hashkey in the returned json data
+ # dictionary.
+ # If you send JSON from the server, you'll receive something like this
+ #
+ # {
+ # data: {
+ # modelName: {
+ # create: [{id: 1, name: 'john'}, {id: 2, name: 'ron'}],
+ # update: [],
+ # delete: []
+ # }
+ # }
+ # }
+ #
+ # To get the array ['one', 'two'] passed to your model, just subscribe
+ # to the key:
+ # Publisher.subscribeModelTo('modelName', myModelInstance)
+ #
+ subscribeModelTo: (model, name) ->
+ @subscriptions[name] or= []
+ @subscriptions[name].push(model)
+
+
+ # This will publish data from the server to all registered subscribers
+ # The parameter 'name' is the name under which subscribers have registered
+ publishDataTo: (data, name) ->
+ for subscriber in @subscriptions[name] || []
+ subscriber.handle(data)
+
+
+ return Publisher \ No newline at end of file