summaryrefslogtreecommitdiffstats
path: root/js/service/ItemResource.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/service/ItemResource.js')
-rw-r--r--js/service/ItemResource.js45
1 files changed, 23 insertions, 22 deletions
diff --git a/js/service/ItemResource.js b/js/service/ItemResource.js
index 9b13f07c7..8cb47d527 100644
--- a/js/service/ItemResource.js
+++ b/js/service/ItemResource.js
@@ -7,38 +7,39 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
-app.factory('ItemResource', function (Resource, $http) {
+app.factory('ItemResource', (Resource, $http) => {
'use strict';
- var ItemResource = function ($http) {
- Resource.call(this, 'id', $http);
- };
+ class ItemResource extends Resource {
- ItemResource.prototype = Object.create(Resource.prototype);
+ constructor ($http) {
+ super('id', $http);
+ }
- ItemResource.prototype.receive = function (value, channel) {
- switch (channel) {
+ receive (value, channel) {
+ switch (channel) {
- case 'newestItemId':
- this.newestItemId = value;
- break;
+ case 'newestItemId':
+ this.newestItemId = value;
+ break;
- case 'starred':
- this.starredCount = value;
- break;
- default:
- Resource.prototype.receive.call(this, value, channel);
+ case 'starred':
+ this.starredCount = value;
+ break;
+ default:
+ super.receive(value, channel);
+ }
}
- };
- ItemResource.prototype.getNewestItemId = function () {
- return this.newestItemId;
- };
+ getNewestItemId () {
+ return this.newestItemId;
+ }
- ItemResource.prototype.getStarredCount = function () {
- return this.starredCount;
- };
+ getStarredCount () {
+ return this.starredCount;
+ }
+ }
return new ItemResource($http);
}); \ No newline at end of file