diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-16 13:19:28 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-16 15:23:12 +0200 |
commit | 8df6d36d49d89f3bb7186b36436606adb039b3f8 (patch) | |
tree | 2fbbe1e55995d0f9277557838a25f351e371540e /js | |
parent | efc118431b6afbb7cc1df887e11195d8c7e761a7 (diff) |
move instantiation into file where object is declared, fix unittests that overwrote services for all unittests and caused them to fail
Diffstat (limited to 'js')
22 files changed, 717 insertions, 704 deletions
diff --git a/js/app/directives/scrollmarksread.coffee b/js/app/directives/newsitemscroll.coffee index 854f17923..5e7e42a3e 100644 --- a/js/app/directives/scrollmarksread.coffee +++ b/js/app/directives/newsitemscroll.coffee @@ -23,7 +23,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. scrolling = true markingRead = true -angular.module('News').directive 'scrollMarksRead', ['$rootScope', 'Config', +angular.module('News').directive 'newsItemScroll', ['$rootScope', 'Config', ($rootScope, Config) -> return (scope, elm, attr) -> @@ -49,14 +49,14 @@ angular.module('News').directive 'scrollMarksRead', ['$rootScope', 'Config', offset = $(feedItem).position().top if offset <= -50 id = parseInt($(feedItem).data('id'), 10) - $rootScope.$broadcast 'readItem', id + #$rootScope.$broadcast 'readItem', id else break , Config.MarkReadTimeout - scope.$apply attr.scrollMarksRead + scope.$apply attr.newsItemScroll ] diff --git a/js/app/services/activefeed.coffee b/js/app/services/activefeed.coffee index 8af9f7573..bdd963f78 100644 --- a/js/app/services/activefeed.coffee +++ b/js/app/services/activefeed.coffee @@ -20,7 +20,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory '_ActiveFeed', -> +angular.module('News').factory 'ActiveFeed', -> class ActiveFeed @@ -45,4 +45,4 @@ angular.module('News').factory '_ActiveFeed', -> return @_id - return ActiveFeed + return new ActiveFeed() diff --git a/js/app/services/businesslayer/itembusinesslayer.coffee b/js/app/services/businesslayer/itembusinesslayer.coffee index 7f8d4fba6..b93f9035d 100644 --- a/js/app/services/businesslayer/itembusinesslayer.coffee +++ b/js/app/services/businesslayer/itembusinesslayer.coffee @@ -73,7 +73,7 @@ StarredBusinessLayer) -> item = @_itemModel.getById(itemId) if angular.isDefined(item) - keptUnread = angular.isDefined(item.keptUnread) and + keptUnread = angular.isDefined(item.keptUnread) and item.keptUnread if not (item.isRead() or keptUnread) diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee index e0006e8d2..fb0ba8e14 100644 --- a/js/app/services/models/feedmodel.coffee +++ b/js/app/services/models/feedmodel.coffee @@ -20,10 +20,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### - -angular.module('News').factory '_FeedModel', -['_Model', '_EqualQuery', -(_Model, _EqualQuery) -> +angular.module('News').factory 'FeedModel', +['_Model', '_EqualQuery', 'Utils', +(_Model, _EqualQuery, Utils) -> class FeedModel extends _Model @@ -166,5 +165,6 @@ angular.module('News').factory '_FeedModel', @_invalidateCache() break - return FeedModel + + return new FeedModel(Utils) ]
\ No newline at end of file diff --git a/js/app/services/models/foldermodel.coffee b/js/app/services/models/foldermodel.coffee index 5dad0bdae..b724ad044 100644 --- a/js/app/services/models/foldermodel.coffee +++ b/js/app/services/models/foldermodel.coffee @@ -20,7 +20,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory '_FolderModel', +angular.module('News').factory 'FolderModel', ['_Model', '_EqualQuery', (_Model, _EqualQuery) -> class FolderModel extends _Model @@ -138,5 +138,5 @@ angular.module('News').factory '_FolderModel', break - return FolderModel + return new FolderModel() ]
\ No newline at end of file diff --git a/js/app/services/models/itemmodel.coffee b/js/app/services/models/itemmodel.coffee index 61030b50e..70b3a9f5c 100644 --- a/js/app/services/models/itemmodel.coffee +++ b/js/app/services/models/itemmodel.coffee @@ -20,7 +20,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory '_ItemModel', +angular.module('News').factory 'ItemModel', ['_Model', '_MaximumQuery', '_MinimumQuery', 'StatusFlag', (_Model, _MaximumQuery, _MinimumQuery, StatusFlag) -> @@ -109,5 +109,5 @@ angular.module('News').factory '_ItemModel', return 0 - return ItemModel + return new ItemModel() ]
\ No newline at end of file diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index 2b627301a..4c4ceb370 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -20,33 +20,31 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### +angular.module('News').factory 'Persistence', +['Request', 'FeedLoading', 'AutoPageLoading', 'NewLoading', 'Config', +'ActiveFeed', '$rootScope', +(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed, +$rootScope) -> -angular.module('News').factory '_Persistence', -> - class Persistence - constructor: (@_request, @_loading, @_config, @_activeFeed, - @_$rootScope) -> + constructor: (@_request, @_feedLoading, @_autoPageLoading, @_newLoading, + @_config, @_activeFeed, @_$rootScope) -> init: -> ### Loads the initial data from the server ### - @_loading.increase() # items can only be loaded after the active feed is known @getActiveFeed => - @getItems @_activeFeed.getType(), @_activeFeed.getId(), 0, => - @_loading.decrease() + @getItems(@_activeFeed.getType(), @_activeFeed.getId()) - triggerHideRead = => - @_triggerHideRead - - @getAllFolders(triggerHideRead) - @getAllFeeds(triggerHideRead) - @userSettingsRead(triggerHideRead) - @getStarredItems(triggerHideRead) + @getAllFolders() + @getAllFeeds() + @userSettingsRead() + @getStarredItems() @userSettingsLanguage() @@ -54,9 +52,22 @@ angular.module('News').factory '_Persistence', -> ITEM CONTROLLER ### getItems: (type, id, offset, onSuccess=null, updatedSince=null) -> - onSuccess or= -> + # show different loading signs + if offset == 0 + loading = @_feedLoading + else + loading = @_autoPageLoading + + # loading sign handling + loading.increase() + successCallbackWrapper = (data) => + onSuccess() + loading.decrease() + failureCallbackWrapper = (data) => + loading.decrease() + if updatedSince != null data = updatedSince: updatedSince @@ -71,14 +82,27 @@ angular.module('News').factory '_Persistence', -> params = data: data - onSuccess: onSuccess + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper @_request.get 'news_items', params getStarredItems: (onSuccess) -> + onSuccess or= -> + + # loading sign handling + @_feedLoading.increase() + successCallbackWrapper = (data) => + onSuccess() + @_feedLoading.decrease() + failureCallbackWrapper = (data) => + @_feedLoading.decrease() + params = - onSuccess: onSuccess + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper + @_request.get 'news_items_starred', params @@ -132,17 +156,36 @@ angular.module('News').factory '_Persistence', -> ### FEED CONTROLLER ### - getAllFeeds: (callback) -> - callback or= -> + getAllFeeds: (onSuccess) -> + onSuccess or= -> + + # loading sign handling + @_feedLoading.increase() + successCallbackWrapper = (data) => + onSuccess() + @_feedLoading.decrease() + failureCallbackWrapper = (data) => + @_feedLoading.decrease() + params = - onSuccess: callback + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper @_request.get 'news_feeds', params getActiveFeed: (onSuccess) -> + # loading sign handling + @_feedLoading.increase() + successCallbackWrapper = (data) => + onSuccess() + @_feedLoading.decrease() + failureCallbackWrapper = (data) => + @_feedLoading.decrease() + params = - onSuccess: onSuccess + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper @_request.get 'news_feeds_active', params @@ -208,10 +251,20 @@ angular.module('News').factory '_Persistence', -> ### FOLDER CONTROLLER ### - getAllFolders: (callback) -> - callback or= -> + getAllFolders: (onSuccess) -> + onSuccess or= -> + + # loading sign handling + @_feedLoading.increase() + successCallbackWrapper = (data) => + onSuccess() + @_feedLoading.decrease() + failureCallbackWrapper = (data) => + @_feedLoading.decrease() + params = - onSuccess: callback + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper @_request.get 'news_folders', params @@ -292,13 +345,23 @@ angular.module('News').factory '_Persistence', -> ### USERSETTINGS CONTROLLER ### - userSettingsRead: (callback=null) -> + userSettingsRead: (onSuccess=null) -> ### Gets the configs for read settings ### - callback or= -> + onSuccess or= -> + + # loading sign handling + @_feedLoading.increase() + successCallbackWrapper = (data) => + onSuccess() + @_feedLoading.decrease() + failureCallbackWrapper = (data) => + @_feedLoading.decrease() + params = - onSuccess: callback + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper @_request.get 'news_usersettings_read', params @@ -321,10 +384,21 @@ angular.module('News').factory '_Persistence', -> @_request.post 'news_usersettings_read_hide', data - userSettingsLanguage: (callback=null) -> - callback or= -> + userSettingsLanguage: (onSuccess=null) -> + onSuccess or= -> + + # loading sign handling + @_feedLoading.increase() + successCallbackWrapper = (data) => + onSuccess() + @_feedLoading.decrease() + failureCallbackWrapper = (data) => + @_feedLoading.decrease() + data = - onSuccess: callback + onSuccess: successCallbackWrapper + onFailure: failureCallbackWrapper + @_request.get 'news_usersettings_language', data @@ -332,5 +406,8 @@ angular.module('News').factory '_Persistence', -> @_$rootScope.$broadcast('triggerHideRead') - return Persistence + return new Persistence(Request, FeedLoading, AutoPageLoading, NewLoading, + Config, ActiveFeed, $rootScope) + +] diff --git a/js/app/services/services.coffee b/js/app/services/services.coffee index d67e1d2c5..537a4492c 100644 --- a/js/app/services/services.coffee +++ b/js/app/services/services.coffee @@ -22,12 +22,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. # request related stuff -angular.module('News').factory 'Persistence', ['_Persistence', 'Request', -'FeedLoading', 'Config', 'ActiveFeed', '$rootScope', -(_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) -> - return new _Persistence(Request, FeedLoading, Config, ActiveFeed, $rootScope) -] - angular.module('News').factory 'Request', ['_Request', '$http', 'Publisher', 'Router', (_Request, $http, Publisher, Router) -> @@ -36,49 +30,18 @@ angular.module('News').factory 'Request', # loading helpers -angular.module('News').factory 'FeedLoading', -['_Loading', (_Loading) -> +angular.module('News').factory 'FeedLoading', ['_Loading', (_Loading) -> return new _Loading() ] -angular.module('News').factory 'AutoPageLoading', -['_Loading', (_Loading) -> +angular.module('News').factory 'AutoPageLoading', ['_Loading', (_Loading) -> return new _Loading() ] -angular.module('News').factory 'NewLoading', -['_Loading', (_Loading) -> +angular.module('News').factory 'NewLoading', ['_Loading', (_Loading) -> return new _Loading() ] -# models -angular.module('News').factory 'ActiveFeed', ['_ActiveFeed', (_ActiveFeed) -> - return new _ActiveFeed() -] - -angular.module('News').factory 'ShowAll', ['_ShowAll', (_ShowAll) -> - return new _ShowAll() -] - -angular.module('News').factory 'StarredCount', ['_StarredCount', -(_StarredCount) -> - return new _StarredCount() -] - -angular.module('News').factory 'FeedModel', ['_FeedModel', 'Utils', -(_FeedModel, Utils) -> - return new _FeedModel(Utils) -] - -angular.module('News').factory 'FolderModel', -['_FolderModel', (_FolderModel) -> - return new _FolderModel() -] - -angular.module('News').factory 'ItemModel', ['_ItemModel', (_ItemModel) -> - return new _ItemModel() -] - angular.module('News').factory 'Publisher', ['_Publisher', 'ActiveFeed', 'ShowAll', 'StarredCount', 'ItemModel', diff --git a/js/app/services/showall.coffee b/js/app/services/showall.coffee index a40f176bc..1d12864c6 100644 --- a/js/app/services/showall.coffee +++ b/js/app/services/showall.coffee @@ -21,7 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory '_ShowAll', -> +angular.module('News').factory 'ShowAll', -> class ShowAll @@ -41,4 +41,4 @@ angular.module('News').factory '_ShowAll', -> @_showAll = showAll - return ShowAll + return new ShowAll() diff --git a/js/app/services/starredcount.coffee b/js/app/services/starredcount.coffee index 9d3d9deb5..1157b4748 100644 --- a/js/app/services/starredcount.coffee +++ b/js/app/services/starredcount.coffee @@ -21,7 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory '_StarredCount', -> +angular.module('News').factory 'StarredCount', -> class StarredCount @@ -41,5 +41,4 @@ angular.module('News').factory '_StarredCount', -> return @_count - - return StarredCount + return new StarredCount() diff --git a/js/public/app.js b/js/public/app.js index c76a338ee..ab3c73783 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -66,46 +66,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.4.0 - -/* - -ownCloud - news - -@author Bernhard Posselt -@copyright 2012 Bernhard Posselt nukeawhale@gmail.com - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -License as published by the Free Software Foundation; either -version 3 of the License, or any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU AFFERO GENERAL PUBLIC LICENSE for more details. - -You should have received a copy of the GNU Affero General Public -License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - - -(function() { - - angular.module('News').directive('clickFocus', function() { - return function(scope, elm, attr) { - var options; - options = scope.$eval(attr.clickFocus); - if (angular.isDefined(options) && angular.isDefined(options.selector)) { - return elm.click(function() { - return $(options.selector).focus(); - }); - } - }; - }); - -}).call(this); - // Generated by CoffeeScript 1.6.2 /* @@ -159,40 +119,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.4.0 - -/* - -ownCloud - App Framework - -@author Bernhard Posselt -@copyright 2012 Bernhard Posselt nukeawhale@gmail.com - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -License as published by the Free Software Foundation; either -version 3 of the License, or any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU AFFERO GENERAL PUBLIC LICENSE for more details. - -You should have received a copy of the GNU Affero General Public -License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - - -(function() { - - angular.module('OC').directive('focusFirstInput', function() { - return function(scope, elm, attr) { - return elm.find('input:first').focus(); - }; - }); - -}).call(this); - // Generated by CoffeeScript 1.6.2 /* @@ -317,7 +243,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. markingRead = true; - angular.module('News').directive('scrollMarksRead', [ + angular.module('News').directive('newsItemScroll', [ '$rootScope', 'Config', function($rootScope, Config) { return function(scope, elm, attr) { return elm.bind('scroll', function() { @@ -338,8 +264,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. feedItem = $elems[_i]; offset = $(feedItem).position().top; if (offset <= -50) { - id = parseInt($(feedItem).data('id'), 10); - _results.push($rootScope.$broadcast('readItem', id)); + _results.push(id = parseInt($(feedItem).data('id'), 10)); } else { break; } @@ -347,7 +272,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return _results; }, Config.MarkReadTimeout); } - return scope.$apply(attr.scrollMarksRead); + return scope.$apply(attr.newsItemScroll); } }); }; @@ -627,7 +552,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { - angular.module('News').factory('_ActiveFeed', function() { + angular.module('News').factory('ActiveFeed', function() { var ActiveFeed; ActiveFeed = (function() { @@ -655,7 +580,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return ActiveFeed; })(); - return ActiveFeed; + return new ActiveFeed(); }); }).call(this); @@ -1617,8 +1542,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - angular.module('News').factory('_FeedModel', [ - '_Model', '_EqualQuery', function(_Model, _EqualQuery) { + angular.module('News').factory('FeedModel', [ + '_Model', '_EqualQuery', 'Utils', function(_Model, _EqualQuery, Utils) { var FeedModel; FeedModel = (function(_super) { @@ -1788,7 +1713,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return FeedModel; })(_Model); - return FeedModel; + return new FeedModel(Utils); } ]); @@ -1821,7 +1746,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - angular.module('News').factory('_FolderModel', [ + angular.module('News').factory('FolderModel', [ '_Model', '_EqualQuery', function(_Model, _EqualQuery) { var FolderModel; @@ -1953,7 +1878,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return FolderModel; })(_Model); - return FolderModel; + return new FolderModel(); } ]); @@ -1986,7 +1911,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - angular.module('News').factory('_ItemModel', [ + angular.module('News').factory('ItemModel', [ '_Model', '_MaximumQuery', '_MinimumQuery', 'StatusFlag', function(_Model, _MaximumQuery, _MinimumQuery, StatusFlag) { var ItemModel; @@ -2093,7 +2018,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return ItemModel; })(_Model); - return ItemModel; + return new ItemModel(); } ]); @@ -2237,442 +2162,515 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { - angular.module('News').factory('_Persistence', function() { - var Persistence; - - Persistence = (function() { - function Persistence(_request, _loading, _config, _activeFeed, _$rootScope) { - this._request = _request; - this._loading = _loading; - this._config = _config; - this._activeFeed = _activeFeed; - this._$rootScope = _$rootScope; - } + angular.module('News').factory('Persistence', [ + 'Request', 'FeedLoading', 'AutoPageLoading', 'NewLoading', 'Config', 'ActiveFeed', '$rootScope', function(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed, $rootScope) { + var Persistence; - Persistence.prototype.init = function() { - /* - Loads the initial data from the server - */ + Persistence = (function() { + function Persistence(_request, _feedLoading, _autoPageLoading, _newLoading, _config, _activeFeed, _$rootScope) { + this._request = _request; + this._feedLoading = _feedLoading; + this._autoPageLoading = _autoPageLoading; + this._newLoading = _newLoading; + this._config = _config; + this._activeFeed = _activeFeed; + this._$rootScope = _$rootScope; + } - var triggerHideRead, - _this = this; + Persistence.prototype.init = function() { + /* + Loads the initial data from the server + */ + + var _this = this; - this._loading.increase(); - this.getActiveFeed(function() { - return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId(), 0, function() { - return _this._loading.decrease(); + this.getActiveFeed(function() { + return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId()); }); - }); - triggerHideRead = function() { - return _this._triggerHideRead; - }; - this.getAllFolders(triggerHideRead); - this.getAllFeeds(triggerHideRead); - this.userSettingsRead(triggerHideRead); - this.getStarredItems(triggerHideRead); - return this.userSettingsLanguage(); - }; + this.getAllFolders(); + this.getAllFeeds(); + this.userSettingsRead(); + this.getStarredItems(); + return this.userSettingsLanguage(); + }; - /* - ITEM CONTROLLER - */ + /* + ITEM CONTROLLER + */ - Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) { - var data, params; + Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) { + var data, failureCallbackWrapper, loading, params, successCallbackWrapper, + _this = this; - if (onSuccess == null) { - onSuccess = null; - } - if (updatedSince == null) { - updatedSince = null; - } - onSuccess || (onSuccess = function() {}); - if (updatedSince !== null) { - data = { - updatedSince: updatedSince, - type: type, - id: id + if (onSuccess == null) { + onSuccess = null; + } + if (updatedSince == null) { + updatedSince = null; + } + onSuccess || (onSuccess = function() {}); + if (offset === 0) { + loading = this._feedLoading; + } else { + loading = this._autoPageLoading; + } + loading.increase(); + successCallbackWrapper = function(data) { + onSuccess(); + return loading.decrease(); }; - } else { - data = { - limit: this._config.itemBatchSize, - offset: offset, - id: id, - type: type + failureCallbackWrapper = function(data) { + return loading.decrease(); }; - } - params = { - data: data, - onSuccess: onSuccess + if (updatedSince !== null) { + data = { + updatedSince: updatedSince, + type: type, + id: id + }; + } else { + data = { + limit: this._config.itemBatchSize, + offset: offset, + id: id, + type: type + }; + } + params = { + data: data, + onSuccess: successCallbackWrapper, + onFailure: failureCallbackWrapper + }; + return this._request.get('news_items', params); }; - return this._request.get('news_items', params); - }; - Persistence.prototype.getStarredItems = function(onSuccess) { - var params; + Persistence.prototype.getStarredItems = function(onSuccess) { + var failureCallbackWrapper, params, successCallbackWrapper, + _this = this; - params = { - onSuccess: onSuccess + onSuccess || (onSuccess = |