diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 15:28:35 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 15:28:35 +0100 |
commit | 503817875b5ffa26a96fa478dc81de5032d82271 (patch) | |
tree | 6bbde3bad0b57c633db458277e7be7a6b19c7bb3 /coffee/lib/services | |
parent | 8f637cfb85f551f6e6e73ec3ff7ea1190a0f30d4 (diff) |
removed old files from the previous news version
Diffstat (limited to 'coffee/lib/services')
-rw-r--r-- | coffee/lib/services/notification.coffee | 18 | ||||
-rw-r--r-- | coffee/lib/services/publisher.coffee | 56 | ||||
-rw-r--r-- | coffee/lib/services/request.coffee | 76 | ||||
-rw-r--r-- | coffee/lib/services/router.coffee | 18 |
4 files changed, 0 insertions, 168 deletions
diff --git a/coffee/lib/services/notification.coffee b/coffee/lib/services/notification.coffee deleted file mode 100644 index dd504a23c..000000000 --- a/coffee/lib/services/notification.coffee +++ /dev/null @@ -1,18 +0,0 @@ -### -# ownCloud -# -# @author Bernhard Posselt -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -### -# Inject notification into angular to make testing easier -### -angular.module('OC').factory 'Notification', -> - return OC.Notification
\ No newline at end of file diff --git a/coffee/lib/services/publisher.coffee b/coffee/lib/services/publisher.coffee deleted file mode 100644 index 03559e37e..000000000 --- a/coffee/lib/services/publisher.coffee +++ /dev/null @@ -1,56 +0,0 @@ -### -# ownCloud -# -# @author Bernhard Posselt -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -### -# Used for properly distributing received model data from the server -### -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 diff --git a/coffee/lib/services/request.coffee b/coffee/lib/services/request.coffee deleted file mode 100644 index b3a0cf7a5..000000000 --- a/coffee/lib/services/request.coffee +++ /dev/null @@ -1,76 +0,0 @@ -### -# ownCloud -# -# @author Bernhard Posselt -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -angular.module('OC').factory '_Request', -> - - class Request - - constructor: (@_$http, @_$rootScope, @_publisher, @_token, @_router) -> - @_initialized = false - @_shelvedRequests = [] - - @_$rootScope.$on 'routesLoaded', => - @_executeShelvedRequests() - @_initialized = true - @_shelvedRequests = [] - - - request: (route, routeParams={}, data={}, onSuccess=null, onFailure=null, config={}) -> - # if routes are not ready yet, save the request - if not @_initialized - @_shelveRequest(route, routeParams, data, method, config) - return - - url = @_router.generate(route, routeParams) - - defaultConfig = - method: 'GET' - url: url - data: data - - # overwrite default values from passed in config - for key, value of config - defaultConfig[key] = value - - @_$http(config) - .success (data, status, headers, config) => - if onSuccess - onSuccess(data, status, headers, config) - - # publish data to models - for name, value of data.data - @publisher.publishDataTo(name, value) - - .error (data, status, headers, config) -> - if onFailure - onFailure(data, status, headers, config) - - - _shelveRequest: (route, routeParams, data, method, config) -> - request = - route: route - routeParams: routeParams - data: data - config: config - method: method - - @_shelvedRequests.push(request) - - - _executeShelvedRequests: -> - for req in @_shelvedRequests - @post(req.route, req.routeParams, req.data, req.method, req.config) - - - - return Request diff --git a/coffee/lib/services/router.coffee b/coffee/lib/services/router.coffee deleted file mode 100644 index a04763585..000000000 --- a/coffee/lib/services/router.coffee +++ /dev/null @@ -1,18 +0,0 @@ -### -# ownCloud -# -# @author Bernhard Posselt -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -### -# Inject router into angular to make testing easier -### -angular.module('OC').factory 'Router', -> - return OC.Router
\ No newline at end of file |