{"action":"created","comment":{"url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/comments/44868492","id":44868492,"diff_hunk":"@@ -1,79 +1,85 @@\n 'use strict';\n \n-(function() {\n-\n-  var _listNoteContent = [];\n-  var _wrapper = document.querySelector('#note-list-wrapper');\n+(function(exports) {\n+    var ListNoteManager = function() {\n+        var _listNoteContent = [];\n+        var _wrapper = null;\n+    };\n \n-  function start() {\n-    fetchList(function(data) {\n-      updateList(data);\n-      drawList();\n-      preloadFirstNote();\n-    });\n-    window.addEventListener('click', function(event) {\n-      onNoteOpen(event);\n-    });\n-  }\n+    ListNoteManager.prototype = {\n+        start() {\n+            this._wrapper = document.querySelector('#note-list-wrapper');\n+            this.fetchList().then((function(data) {\n+                this.updateList(data);\n+                this.drawList();\n+                this.preloadFirstNote();\n+            }).bind(this));\n+            window.addEventListener('click', (function(event) {\n+                this.onNoteOpen(event);\n+            }).bind(this));\n+        },\n \n-  function onNoteOpen(event) {\n-    if (event.target.classList.contains('note-title')) {\n-      var id = event.target.dataset.noteId;\n-      var content = _listNoteContent[id];\n-      window.dispatchEvent(new CustomEvent('note-open',\n-        { detail: content }));\n-    };\n-  }\n+        onNoteOpen(event) {\n+            if (event.target.classList.contains('note-title')) {\n+                var id = event.target.dataset.noteId;\n+                var content = this._listNoteContent[id];\n+                window.dispatchEvent(new CustomEvent('note-open', {\n+                    detail: content\n+                }));\n+            };\n+        },\n \n-  function preloadFirstNote() {\n-    if (_listNoteContent.length !== 0) {\n-      var content = _listNoteContent[0];\n-      window.dispatchEvent(new CustomEvent('note-open',\n-        { detail: content }));\n-    }\n-  }\n+        preloadFirstNote() {\n+            if (this._listNoteContent.length !== 0) {","path":"homework/list.js","position":62,"original_position":62,"commit_id":"777262bf9bc2ab8497b944f65cede5504c5cd63b","original_commit_id":"777262bf9bc2ab8497b944f65cede5504c5cd63b","user":{"login":"snowmantw","id":129153,"avatar_url":"https://avatars.githubusercontent.com/u/129153?v=3","gravatar_id":"","url":"https://api.github.com/users/snowmantw","html_url":"https://github.com/snowmantw","followers_url":"https://api.github.com/users/snowmantw/followers","following_url":"https://api.github.com/users/snowmantw/following{/other_user}","gists_url":"https://api.github.com/users/snowmantw/gists{/gist_id}","starred_url":"https://api.github.com/users/snowmantw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowmantw/subscriptions","organizations_url":"https://api.github.com/users/snowmantw/orgs","repos_url":"https://api.github.com/users/snowmantw/repos","events_url":"https://api.github.com/users/snowmantw/events{/privacy}","received_events_url":"https://api.github.com/users/snowmantw/received_events","type":"User","site_admin":false},"body":"If a function body is wrapped with one conditional statement with only one branch, the `if...else` should be put in the caller, rather than the callee.","created_at":"2015-11-15T07:37:31Z","updated_at":"2015-11-15T07:37:31Z","html_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pull/14#discussion_r44868492","pull_request_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/comments/44868492"},"html":{"href":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pull/14#discussion_r44868492"},"pull_request":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14","id":48069720,"html_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pull/14","diff_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pull/14.diff","patch_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pull/14.patch","issue_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues/14","number":14,"state":"open","locked":false,"title":"Homework","user":{"login":"star096374","id":9212798,"avatar_url":"https://avatars.githubusercontent.com/u/9212798?v=3","gravatar_id":"","url":"https://api.github.com/users/star096374","html_url":"https://github.com/star096374","followers_url":"https://api.github.com/users/star096374/followers","following_url":"https://api.github.com/users/star096374/following{/other_user}","gists_url":"https://api.github.com/users/star096374/gists{/gist_id}","starred_url":"https://api.github.com/users/star096374/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/star096374/subscriptions","organizations_url":"https://api.github.com/users/star096374/orgs","repos_url":"https://api.github.com/users/star096374/repos","events_url":"https://api.github.com/users/star096374/events{/privacy}","received_events_url":"https://api.github.com/users/star096374/received_events","type":"User","site_admin":false},"body":"Finish Tier1\r\nreview=?@FlowerHop,@snowmantw,@chungya","created_at":"2015-10-19T13:14:55Z","updated_at":"2015-11-15T07:37:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"769138a0949c9b0bd1329188a355e48d09a49e1a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14/commits","review_comments_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14/comments","review_comment_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues/14/comments","statuses_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/statuses/777262bf9bc2ab8497b944f65cede5504c5cd63b","head":{"label":"star096374:homework","ref":"homework","sha":"777262bf9bc2ab8497b944f65cede5504c5cd63b","user":{"login":"star096374","id":9212798,"avatar_url":"https://avatars.githubusercontent.com/u/9212798?v=3","gravatar_id":"","url":"https://api.github.com/users/star096374","html_url":"https://github.com/star096374","followers_url":"https://api.github.com/users/star096374/followers","following_url":"https://api.github.com/users/star096374/following{/other_user}","gists_url":"https://api.github.com/users/star096374/gists{/gist_id}","starred_url":"https://api.github.com/users/star096374/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/star096374/subscriptions","organizations_url":"https://api.github.com/users/star096374/orgs","repos_url":"https://api.github.com/users/star096374/repos","events_url":"https://api.github.com/users/star096374/events{/privacy}","received_events_url":"https://api.github.com/users/star096374/received_events","type":"User","site_admin":false},"repo":{"id":44430413,"name":"Lesson-03-JavaScriptBestPratice-HW","full_name":"star096374/Lesson-03-JavaScriptBestPratice-HW","owner":{"login":"star096374","id":9212798,"avatar_url":"https://avatars.githubusercontent.com/u/9212798?v=3","gravatar_id":"","url":"https://api.github.com/users/star096374","html_url":"https://github.com/star096374","followers_url":"https://api.github.com/users/star096374/followers","following_url":"https://api.github.com/users/star096374/following{/other_user}","gists_url":"https://api.github.com/users/star096374/gists{/gist_id}","starred_url":"https://api.github.com/users/star096374/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/star096374/subscriptions","organizations_url":"https://api.github.com/users/star096374/orgs","repos_url":"https://api.github.com/users/star096374/repos","events_url":"https://api.github.com/users/star096374/events{/privacy}","received_events_url":"https://api.github.com/users/star096374/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/star096374/Lesson-03-JavaScriptBestPratice-HW","description":"Homework","fork":true,"url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW","forks_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/forks","keys_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/keys{/key_id}","collaborators_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/teams","hooks_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/hooks","issue_events_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/issues/events{/number}","events_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/events","assignees_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/assignees{/user}","branches_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/branches{/branch}","tags_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/tags","blobs_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/git/refs{/sha}","trees_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/git/trees{/sha}","statuses_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/statuses/{sha}","languages_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/languages","stargazers_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/stargazers","contributors_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/contributors","subscribers_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/subscribers","subscription_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/subscription","commits_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/commits{/sha}","git_commits_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/git/commits{/sha}","comments_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/comments{/number}","issue_comment_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/issues/comments{/number}","contents_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/contents/{+path}","compare_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/compare/{base}...{head}","merges_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/merges","archive_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/downloads","issues_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/issues{/number}","pulls_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/pulls{/number}","milestones_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/milestones{/number}","notifications_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/labels{/name}","releases_url":"https://api.github.com/repos/star096374/Lesson-03-JavaScriptBestPratice-HW/releases{/id}","created_at":"2015-10-17T09:00:24Z","updated_at":"2015-10-17T09:00:25Z","pushed_at":"2015-10-19T13:10:00Z","git_url":"git://github.com/star096374/Lesson-03-JavaScriptBestPratice-HW.git","ssh_url":"git@github.com:star096374/Lesson-03-JavaScriptBestPratice-HW.git","clone_url":"https://github.com/star096374/Lesson-03-JavaScriptBestPratice-HW.git","svn_url":"https://github.com/star096374/Lesson-03-JavaScriptBestPratice-HW","homepage":null,"size":102,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MAP-NCU2015:homework","ref":"homework","sha":"f5793106932580f974907d375e4765576fc923f4","user":{"login":"MAP-NCU2015","id":14105726,"avatar_url":"https://avatars.githubusercontent.com/u/14105726?v=3","gravatar_id":"","url":"https://api.github.com/users/MAP-NCU2015","html_url":"https://github.com/MAP-NCU2015","followers_url":"https://api.github.com/users/MAP-NCU2015/followers","following_url":"https://api.github.com/users/MAP-NCU2015/following{/other_user}","gists_url":"https://api.github.com/users/MAP-NCU2015/gists{/gist_id}","starred_url":"https://api.github.com/users/MAP-NCU2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MAP-NCU2015/subscriptions","organizations_url":"https://api.github.com/users/MAP-NCU2015/orgs","repos_url":"https://api.github.com/users/MAP-NCU2015/repos","events_url":"https://api.github.com/users/MAP-NCU2015/events{/privacy}","received_events_url":"https://api.github.com/users/MAP-NCU2015/received_events","type":"Organization","site_admin":false},"repo":{"id":42401840,"name":"Lesson-03-JavaScriptBestPratice-HW","full_name":"MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW","owner":{"login":"MAP-NCU2015","id":14105726,"avatar_url":"https://avatars.githubusercontent.com/u/14105726?v=3","gravatar_id":"","url":"https://api.github.com/users/MAP-NCU2015","html_url":"https://github.com/MAP-NCU2015","followers_url":"https://api.github.com/users/MAP-NCU2015/followers","following_url":"https://api.github.com/users/MAP-NCU2015/following{/other_user}","gists_url":"https://api.github.com/users/MAP-NCU2015/gists{/gist_id}","starred_url":"https://api.github.com/users/MAP-NCU2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MAP-NCU2015/subscriptions","organizations_url":"https://api.github.com/users/MAP-NCU2015/orgs","repos_url":"https://api.github.com/users/MAP-NCU2015/repos","events_url":"https://api.github.com/users/MAP-NCU2015/events{/privacy}","received_events_url":"https://api.github.com/users/MAP-NCU2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW","description":"Homework","fork":false,"url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW","forks_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/forks","keys_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/teams","hooks_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/hooks","issue_events_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues/events{/number}","events_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/events","assignees_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/assignees{/user}","branches_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/branches{/branch}","tags_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/tags","blobs_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/git/refs{/sha}","trees_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/statuses/{sha}","languages_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/languages","stargazers_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/stargazers","contributors_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/contributors","subscribers_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/subscribers","subscription_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/subscription","commits_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/commits{/sha}","git_commits_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/git/commits{/sha}","comments_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/comments{/number}","issue_comment_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues/comments{/number}","contents_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/contents/{+path}","compare_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/merges","archive_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/downloads","issues_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues{/number}","pulls_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls{/number}","milestones_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/milestones{/number}","notifications_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/labels{/name}","releases_url":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/releases{/id}","created_at":"2015-09-13T15:48:05Z","updated_at":"2015-09-27T15:29:42Z","pushed_at":"2015-11-12T11:23:29Z","git_url":"git://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW.git","ssh_url":"git@github.com:MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW.git","clone_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW.git","svn_url":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW","homepage":null,"size":863,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":45,"forks":57,"open_issues":45,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14"},"html":{"href":"https://github.com/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pull/14"},"issue":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues/14"},"comments":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/MAP-NCU2015/Lesson-03-JavaScriptBestPratice-HW/statuses/777262bf9bc2ab8497b944f65cede5504c5cd63b"}}}}