GitHub PullRequestReviewCommentEvent at 2014-04-09 02:26:56
Repository: app
Actor: kenkouot
Payload: {"comment":{"url":"https://api.github.com/repos/Wikia/app/pulls/comments/11420593","id":11420593,"diff_hunk":"@@ -0,0 +1,59 @@\n+define('specialVideos.mobile.collections.videos', [\n+\t'wikia.nirvana'\n+], function (nirvana) {\n+\t'use strict';\n+\n+\tvar filters = {\n+\t\ttrending: 'trend',\n+\t\tlatest: 'recent'\n+\t};\n+\n+\t/**\n+\t * VideoCollection\n+\t * @constructor\n+\t */\n+\tfunction VideoCollection() {\n+\t\t// set page to 1, maintains page number for updating collection via 'load more' interaction\n+\t\tthis.page = 1;\n+\t\tthis.filter = filters.trending;\n+\t}\n+\n+\tVideoCollection.prototype.getFilterKey = function (filter) {\n+\t\treturn filter ? filters[filter.toLowerCase()] : this.filter;\n+\t};\n+\n+\t/**\n+\t * fetch\n+\t * @description get new videos from server\n+\t * @param filter {String} a string value of either 'trending' or 'latest'\n+\t * @return {jQuery Promise} xhr\n+\t */\n+\tVideoCollection.prototype.fetch = function (filter) {\n+\t\tvar self = this;\n+\n+\t\t// if filter is explicitly passed, set it, otherwise\n+\t\t// request will be set with cached filter value\n+\t\tif (filter) {\n+\t\t\tthis.filter = filter;\n+\t\t\tthis.page = 1;\n+\t\t}\n+\n+\t\t// cancel any pending xhr\n+\t\tif (this.xhr) {\n+\t\t\tthis.xhr.abort();\n+\t\t}\n+\n+\t\tthis.xhr = nirvana.getJson('SpecialVideosSpecial', 'getVideos', {\n+\t\t\tsort: this.getFilterKey(filter),\n+\t\t\t// if the sort changes, we reset to page 0\n+\t\t\t// otherwise we increment the page number then send request\n+\t\t\tpage: filter ? 1 : ++this.page\n+\t\t}).success(function (data) {\n+\t\t\tself.data = data;\n+\t\t});","path":"extensions/wikia/SpecialVideos/scripts/mobile/collections/video.js","position":53,"original_position":53,"commit_id":"00df9ce4d03199222a6580dbdcbae3206a3e7c50","original_commit_id":"00df9ce4d03199222a6580dbdcbae3206a3e7c50","user":{"login":"kenkouot","id":2964310,"avatar_url":"https://avatars.githubusercontent.com/u/2964310?","gravatar_id":"0a53bced375d99069b2d728410ea822b","url":"https://api.github.com/users/kenkouot","html_url":"https://github.com/kenkouot","followers_url":"https://api.github.com/users/kenkouot/followers","following_url":"https://api.github.com/users/kenkouot/following{/other_user}","gists_url":"https://api.github.com/users/kenkouot/gists{/gist_id}","starred_url":"https://api.github.com/users/kenkouot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenkouot/subscriptions","organizations_url":"https://api.github.com/users/kenkouot/orgs","repos_url":"https://api.github.com/users/kenkouot/repos","events_url":"https://api.github.com/users/kenkouot/events{/privacy}","received_events_url":"https://api.github.com/users/kenkouot/received_events","type":"User","site_admin":false},"body":"While technically possible, such an approach can get out of hand quickly for many reasons, not limited to the dynamism of the content, potentially increased rendering times (from larger maintained collections) and increasing code complexity. While there are great cases of local caching, I'm not confident this is one of them. ","created_at":"2014-04-09T02:26:56Z","updated_at":"2014-04-09T02:26:56Z","html_url":"https://github.com/Wikia/app/pull/3328#discussion_r11420593","pull_request_url":"https://api.github.com/repos/Wikia/app/pulls/3328","_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/11420593"},"html":{"href":"https://github.com/Wikia/app/pull/3328#discussion_r11420593"},"pull_request":{"href":"https://api.github.com/repos/Wikia/app/pulls/3328"}}}}