diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-20 17:01:59 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-20 17:01:59 +0200 |
commit | 5a7b1e0c36c2dd564f44568de766118b07be49ad (patch) | |
tree | 23b9f80bb4509dd51948c3851660f5fa3754031d /js/service/ItemResource.js | |
parent | b5d5b2b22a2b4aabd4c9bb5c8b89aae10facc735 (diff) |
rename model to resource
Diffstat (limited to 'js/service/ItemResource.js')
-rw-r--r-- | js/service/ItemResource.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/js/service/ItemResource.js b/js/service/ItemResource.js new file mode 100644 index 000000000..9b13f07c7 --- /dev/null +++ b/js/service/ItemResource.js @@ -0,0 +1,44 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2014 + */ +app.factory('ItemResource', function (Resource, $http) { + 'use strict'; + + var ItemResource = function ($http) { + Resource.call(this, 'id', $http); + }; + + ItemResource.prototype = Object.create(Resource.prototype); + + ItemResource.prototype.receive = function (value, channel) { + switch (channel) { + + case 'newestItemId': + this.newestItemId = value; + break; + + case 'starred': + this.starredCount = value; + break; + default: + Resource.prototype.receive.call(this, value, channel); + } + }; + + ItemResource.prototype.getNewestItemId = function () { + return this.newestItemId; + }; + + ItemResource.prototype.getStarredCount = function () { + return this.starredCount; + }; + + + return new ItemResource($http); +});
\ No newline at end of file |