{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/comments/86682346","pull_request_review_id":7329535,"id":86682346,"diff_hunk":"@@ -1,68 +1,131 @@\n 'use strict';\n \n-/**\n- * Сделано задание на звездочку\n- * Реализованы методы several и through\n- */\n getEmitter.isStar = true;\n module.exports = getEmitter;\n \n-/**\n- * Возвращает новый emitter\n- * @returns {Object}\n- */\n+function startEvents(event, events) {\n+    if (events.hasOwnProperty(event)) {\n+        events[event].forEach(function (student) {\n+            if (student.frequencyCounter > 0) {\n+                student.frequencyCounter--;\n+            }\n+            if (student.times > 0 && student.frequencyCounter === 0) {\n+                student.times--;\n+                student.frequencyCounter = student.frequency;\n+                student.handler.call(student.context);\n+            }\n+        });\n+    }\n+}\n+\n function getEmitter() {\n+    var events = {};\n+\n     return {\n \n-        /**\n-         * Подписаться на событие\n-         * @param {String} event\n-         * @param {Object} context\n-         * @param {Function} handler\n-         */\n         on: function (event, context, handler) {\n-            console.info(event, context, handler);\n+            addEvent(event, context, handler, events);\n+\n+            return this;\n         },\n \n-        /**\n-         * Отписаться от события\n-         * @param {String} event\n-         * @param {Object} context\n-         */\n         off: function (event, context) {\n-            console.info(event, context);\n+            Object.keys(events).forEach(function (key) {\n+                if (event === key.split('.').slice(0, (event.split('.').length))\n+                        .join('.')) {","path":"emitter.js","position":56,"original_position":56,"commit_id":"943b65854f3bc82afbc3829a46b3ff69b2dfd43b","original_commit_id":"943b65854f3bc82afbc3829a46b3ff69b2dfd43b","user":{"login":"Lakate","id":8994274,"avatar_url":"https://avatars.githubusercontent.com/u/8994274?v=3","gravatar_id":"","url":"https://api.github.com/users/Lakate","html_url":"https://github.com/Lakate","followers_url":"https://api.github.com/users/Lakate/followers","following_url":"https://api.github.com/users/Lakate/following{/other_user}","gists_url":"https://api.github.com/users/Lakate/gists{/gist_id}","starred_url":"https://api.github.com/users/Lakate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lakate/subscriptions","organizations_url":"https://api.github.com/users/Lakate/orgs","repos_url":"https://api.github.com/users/Lakate/repos","events_url":"https://api.github.com/users/Lakate/events{/privacy}","received_events_url":"https://api.github.com/users/Lakate/received_events","type":"User","site_admin":false},"body":"нечитаемое условие получилось, и опять этот перенос. Давай в переменную вынесем вторую границу для ```splice```","created_at":"2016-11-06T09:35:01Z","updated_at":"2016-11-06T09:35:01Z","html_url":"https://github.com/urfu-2016/javascript-task-5/pull/8#discussion_r86682346","pull_request_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/comments/86682346"},"html":{"href":"https://github.com/urfu-2016/javascript-task-5/pull/8#discussion_r86682346"},"pull_request":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8","id":92375423,"html_url":"https://github.com/urfu-2016/javascript-task-5/pull/8","diff_url":"https://github.com/urfu-2016/javascript-task-5/pull/8.diff","patch_url":"https://github.com/urfu-2016/javascript-task-5/pull/8.patch","issue_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues/8","number":8,"state":"open","locked":false,"title":"Заморский Глеб","user":{"login":"Zeace","id":22629906,"avatar_url":"https://avatars.githubusercontent.com/u/22629906?v=3","gravatar_id":"","url":"https://api.github.com/users/Zeace","html_url":"https://github.com/Zeace","followers_url":"https://api.github.com/users/Zeace/followers","following_url":"https://api.github.com/users/Zeace/following{/other_user}","gists_url":"https://api.github.com/users/Zeace/gists{/gist_id}","starred_url":"https://api.github.com/users/Zeace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zeace/subscriptions","organizations_url":"https://api.github.com/users/Zeace/orgs","repos_url":"https://api.github.com/users/Zeace/repos","events_url":"https://api.github.com/users/Zeace/events{/privacy}","received_events_url":"https://api.github.com/users/Zeace/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-04T16:44:50Z","updated_at":"2016-11-06T09:40:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83e46c991dd173ec9f172b178238fb3a87bc1f38","assignee":{"login":"Lakate","id":8994274,"avatar_url":"https://avatars.githubusercontent.com/u/8994274?v=3","gravatar_id":"","url":"https://api.github.com/users/Lakate","html_url":"https://github.com/Lakate","followers_url":"https://api.github.com/users/Lakate/followers","following_url":"https://api.github.com/users/Lakate/following{/other_user}","gists_url":"https://api.github.com/users/Lakate/gists{/gist_id}","starred_url":"https://api.github.com/users/Lakate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lakate/subscriptions","organizations_url":"https://api.github.com/users/Lakate/orgs","repos_url":"https://api.github.com/users/Lakate/repos","events_url":"https://api.github.com/users/Lakate/events{/privacy}","received_events_url":"https://api.github.com/users/Lakate/received_events","type":"User","site_admin":false},"assignees":[{"login":"Lakate","id":8994274,"avatar_url":"https://avatars.githubusercontent.com/u/8994274?v=3","gravatar_id":"","url":"https://api.github.com/users/Lakate","html_url":"https://github.com/Lakate","followers_url":"https://api.github.com/users/Lakate/followers","following_url":"https://api.github.com/users/Lakate/following{/other_user}","gists_url":"https://api.github.com/users/Lakate/gists{/gist_id}","starred_url":"https://api.github.com/users/Lakate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lakate/subscriptions","organizations_url":"https://api.github.com/users/Lakate/orgs","repos_url":"https://api.github.com/users/Lakate/repos","events_url":"https://api.github.com/users/Lakate/events{/privacy}","received_events_url":"https://api.github.com/users/Lakate/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8/commits","review_comments_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8/comments","review_comment_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues/8/comments","statuses_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/statuses/943b65854f3bc82afbc3829a46b3ff69b2dfd43b","head":{"label":"Zeace:master","ref":"master","sha":"943b65854f3bc82afbc3829a46b3ff69b2dfd43b","user":{"login":"Zeace","id":22629906,"avatar_url":"https://avatars.githubusercontent.com/u/22629906?v=3","gravatar_id":"","url":"https://api.github.com/users/Zeace","html_url":"https://github.com/Zeace","followers_url":"https://api.github.com/users/Zeace/followers","following_url":"https://api.github.com/users/Zeace/following{/other_user}","gists_url":"https://api.github.com/users/Zeace/gists{/gist_id}","starred_url":"https://api.github.com/users/Zeace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zeace/subscriptions","organizations_url":"https://api.github.com/users/Zeace/orgs","repos_url":"https://api.github.com/users/Zeace/repos","events_url":"https://api.github.com/users/Zeace/events{/privacy}","received_events_url":"https://api.github.com/users/Zeace/received_events","type":"User","site_admin":false},"repo":{"id":72849150,"name":"javascript-task-5","full_name":"Zeace/javascript-task-5","owner":{"login":"Zeace","id":22629906,"avatar_url":"https://avatars.githubusercontent.com/u/22629906?v=3","gravatar_id":"","url":"https://api.github.com/users/Zeace","html_url":"https://github.com/Zeace","followers_url":"https://api.github.com/users/Zeace/followers","following_url":"https://api.github.com/users/Zeace/following{/other_user}","gists_url":"https://api.github.com/users/Zeace/gists{/gist_id}","starred_url":"https://api.github.com/users/Zeace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zeace/subscriptions","organizations_url":"https://api.github.com/users/Zeace/orgs","repos_url":"https://api.github.com/users/Zeace/repos","events_url":"https://api.github.com/users/Zeace/events{/privacy}","received_events_url":"https://api.github.com/users/Zeace/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zeace/javascript-task-5","description":"Задача «Пора на лекцию»","fork":true,"url":"https://api.github.com/repos/Zeace/javascript-task-5","forks_url":"https://api.github.com/repos/Zeace/javascript-task-5/forks","keys_url":"https://api.github.com/repos/Zeace/javascript-task-5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zeace/javascript-task-5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zeace/javascript-task-5/teams","hooks_url":"https://api.github.com/repos/Zeace/javascript-task-5/hooks","issue_events_url":"https://api.github.com/repos/Zeace/javascript-task-5/issues/events{/number}","events_url":"https://api.github.com/repos/Zeace/javascript-task-5/events","assignees_url":"https://api.github.com/repos/Zeace/javascript-task-5/assignees{/user}","branches_url":"https://api.github.com/repos/Zeace/javascript-task-5/branches{/branch}","tags_url":"https://api.github.com/repos/Zeace/javascript-task-5/tags","blobs_url":"https://api.github.com/repos/Zeace/javascript-task-5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zeace/javascript-task-5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zeace/javascript-task-5/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zeace/javascript-task-5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zeace/javascript-task-5/statuses/{sha}","languages_url":"https://api.github.com/repos/Zeace/javascript-task-5/languages","stargazers_url":"https://api.github.com/repos/Zeace/javascript-task-5/stargazers","contributors_url":"https://api.github.com/repos/Zeace/javascript-task-5/contributors","subscribers_url":"https://api.github.com/repos/Zeace/javascript-task-5/subscribers","subscription_url":"https://api.github.com/repos/Zeace/javascript-task-5/subscription","commits_url":"https://api.github.com/repos/Zeace/javascript-task-5/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zeace/javascript-task-5/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zeace/javascript-task-5/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zeace/javascript-task-5/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zeace/javascript-task-5/contents/{+path}","compare_url":"https://api.github.com/repos/Zeace/javascript-task-5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zeace/javascript-task-5/merges","archive_url":"https://api.github.com/repos/Zeace/javascript-task-5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zeace/javascript-task-5/downloads","issues_url":"https://api.github.com/repos/Zeace/javascript-task-5/issues{/number}","pulls_url":"https://api.github.com/repos/Zeace/javascript-task-5/pulls{/number}","milestones_url":"https://api.github.com/repos/Zeace/javascript-task-5/milestones{/number}","notifications_url":"https://api.github.com/repos/Zeace/javascript-task-5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zeace/javascript-task-5/labels{/name}","releases_url":"https://api.github.com/repos/Zeace/javascript-task-5/releases{/id}","deployments_url":"https://api.github.com/repos/Zeace/javascript-task-5/deployments","created_at":"2016-11-04T13:15:16Z","updated_at":"2016-11-04T13:15:17Z","pushed_at":"2016-11-05T12:28:27Z","git_url":"git://github.com/Zeace/javascript-task-5.git","ssh_url":"git@github.com:Zeace/javascript-task-5.git","clone_url":"https://github.com/Zeace/javascript-task-5.git","svn_url":"https://github.com/Zeace/javascript-task-5","homepage":"","size":11,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"urfu-2016:master","ref":"master","sha":"563654f35c98e52f1903ca1d4781372abdfb400e","user":{"login":"urfu-2016","id":22170529,"avatar_url":"https://avatars.githubusercontent.com/u/22170529?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2016","html_url":"https://github.com/urfu-2016","followers_url":"https://api.github.com/users/urfu-2016/followers","following_url":"https://api.github.com/users/urfu-2016/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2016/subscriptions","organizations_url":"https://api.github.com/users/urfu-2016/orgs","repos_url":"https://api.github.com/users/urfu-2016/repos","events_url":"https://api.github.com/users/urfu-2016/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":72473952,"name":"javascript-task-5","full_name":"urfu-2016/javascript-task-5","owner":{"login":"urfu-2016","id":22170529,"avatar_url":"https://avatars.githubusercontent.com/u/22170529?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2016","html_url":"https://github.com/urfu-2016","followers_url":"https://api.github.com/users/urfu-2016/followers","following_url":"https://api.github.com/users/urfu-2016/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2016/subscriptions","organizations_url":"https://api.github.com/users/urfu-2016/orgs","repos_url":"https://api.github.com/users/urfu-2016/repos","events_url":"https://api.github.com/users/urfu-2016/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2016/javascript-task-5","description":"Задача «Пора на лекцию»","fork":false,"url":"https://api.github.com/repos/urfu-2016/javascript-task-5","forks_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/forks","keys_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/teams","hooks_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/hooks","issue_events_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/events","assignees_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/tags","blobs_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/languages","stargazers_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/stargazers","contributors_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/contributors","subscribers_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/subscribers","subscription_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/subscription","commits_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/merges","archive_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/downloads","issues_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2016/javascript-task-5/deployments","created_at":"2016-10-31T20:11:32Z","updated_at":"2016-11-03T13:58:41Z","pushed_at":"2016-11-06T09:04:57Z","git_url":"git://github.com/urfu-2016/javascript-task-5.git","ssh_url":"git@github.com:urfu-2016/javascript-task-5.git","clone_url":"https://github.com/urfu-2016/javascript-task-5.git","svn_url":"https://github.com/urfu-2016/javascript-task-5","homepage":"","size":6,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":16,"forks":39,"open_issues":16,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8"},"html":{"href":"https://github.com/urfu-2016/javascript-task-5/pull/8"},"issue":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues/8"},"comments":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-5/statuses/943b65854f3bc82afbc3829a46b3ff69b2dfd43b"}}}}
{"actor":{"display_login":"Lakate"}}