{"action":"created","comment":{"url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/comments/82979520","pull_request_review_id":3848341,"id":82979520,"diff_hunk":"@@ -1078,15 +1078,15 @@ describe 'Selection Api', ->\n     div = hx.detached('div')\n     called = false\n     div.on 'click', (e) -> called = true\n-    div.node().__hx__.eventEmitter.emit('click', {})\n+    testHelpers.fakeNodeEvent(div.node(), 'click')({})","path":"modules/selection/test/spec.coffee","position":5,"original_position":5,"commit_id":"5c542a7e1a5cd3775440613747bd8ea36b5cb8ec","original_commit_id":"5c542a7e1a5cd3775440613747bd8ea36b5cb8ec","user":{"login":"c-frater","id":3194349,"avatar_url":"https://avatars.githubusercontent.com/u/3194349?v=3","gravatar_id":"","url":"https://api.github.com/users/c-frater","html_url":"https://github.com/c-frater","followers_url":"https://api.github.com/users/c-frater/followers","following_url":"https://api.github.com/users/c-frater/following{/other_user}","gists_url":"https://api.github.com/users/c-frater/gists{/gist_id}","starred_url":"https://api.github.com/users/c-frater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c-frater/subscriptions","organizations_url":"https://api.github.com/users/c-frater/orgs","repos_url":"https://api.github.com/users/c-frater/repos","events_url":"https://api.github.com/users/c-frater/events{/privacy}","received_events_url":"https://api.github.com/users/c-frater/received_events","type":"User","site_admin":false},"body":"One of the tests was failing for selection and whilst I was investigating I thought I might as well update to use `testHelpers`","created_at":"2016-10-12T10:40:57Z","updated_at":"2016-10-12T10:46:21Z","html_url":"https://github.com/ocadotechnology/hexagonjs/pull/340#discussion_r82979520","pull_request_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340","_links":{"self":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/comments/82979520"},"html":{"href":"https://github.com/ocadotechnology/hexagonjs/pull/340#discussion_r82979520"},"pull_request":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340"}}},"pull_request":{"url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340","id":88992455,"html_url":"https://github.com/ocadotechnology/hexagonjs/pull/340","diff_url":"https://github.com/ocadotechnology/hexagonjs/pull/340.diff","patch_url":"https://github.com/ocadotechnology/hexagonjs/pull/340.patch","issue_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/340","number":340,"state":"open","locked":false,"title":"#179: bugfix event emitter memory leak","user":{"login":"c-frater","id":3194349,"avatar_url":"https://avatars.githubusercontent.com/u/3194349?v=3","gravatar_id":"","url":"https://api.github.com/users/c-frater","html_url":"https://github.com/c-frater","followers_url":"https://api.github.com/users/c-frater/followers","following_url":"https://api.github.com/users/c-frater/following{/other_user}","gists_url":"https://api.github.com/users/c-frater/gists{/gist_id}","starred_url":"https://api.github.com/users/c-frater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c-frater/subscriptions","organizations_url":"https://api.github.com/users/c-frater/orgs","repos_url":"https://api.github.com/users/c-frater/repos","events_url":"https://api.github.com/users/c-frater/events{/privacy}","received_events_url":"https://api.github.com/users/c-frater/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above in the following format -->\r\n<!--- #404: resolved issue with data table -->\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\nUpdated the `off` method of `EventEmitter` to check if a `BasicEventEmitter` is empty after the callback/listeners have been removed and remove it from the `EventEmitter` if it has no listeners left.\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here (e.g. Resolves #404) -->\r\nResolves #179 \r\n\r\n## How Has This Been Tested?\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\nIn addition to adding tests, I used the following to test in the browser:\r\n```js\r\nhx.range(500).map(() => setInterval(addTest, 1))\r\nfunction addTest () {\r\n  const cd = new hx.ClickDetector()\r\n  cd.cleanUp()\r\n}\r\n```\r\nThis rapidly creates name-spaced event emitters on the `document` (for `pointer-up`/`pointer-down`) and then calls the cleanup on the click detector to remove them straight away.\r\nI then used the chrome developer tools to look a the JS Heap over 6 seconds (that's all the buffer can store in this example):\r\n\r\nBefore Change (bottom of graph is 240mb, top is 366mb):\r\n![screen shot 2016-10-12 at 11 36 38](https://cloud.githubusercontent.com/assets/3194349/19306993/2cac4e9a-9070-11e6-942b-e2bd5eb168c9.png)\r\nAfter Change (bottom of graph is 11mb, top is 33mb)\r\n![screen shot 2016-10-12 at 11 35 41](https://cloud.githubusercontent.com/assets/3194349/19306994/2cb2b758-9070-11e6-8d16-21217614b9bc.png)\r\n\r\nBefore the change, the memory use increased rapidly at a constant rate until the browser tab crashed.\r\nAfter the change, the memory usage stays consistently low and does not crash the browser tab.\r\n\r\n## Screenshots (if appropriate):\r\nN/A\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [x] Bug fix (non-breaking change which fixes an issue)\r\n- [ ] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\n- [x] I have read the **CONTRIBUTING** document.\r\n- [x] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.\r\n","created_at":"2016-10-12T10:40:10Z","updated_at":"2016-10-12T10:46:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e9e77387c80a4dc1266a93c4df0f9924d84aaf0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340/commits","review_comments_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340/comments","review_comment_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/340/comments","statuses_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/statuses/5c542a7e1a5cd3775440613747bd8ea36b5cb8ec","head":{"label":"ocadotechnology:#179-bugfix-event-emitter-memory-leak","ref":"#179-bugfix-event-emitter-memory-leak","sha":"5c542a7e1a5cd3775440613747bd8ea36b5cb8ec","user":{"login":"ocadotechnology","id":2088731,"avatar_url":"https://avatars.githubusercontent.com/u/2088731?v=3","gravatar_id":"","url":"https://api.github.com/users/ocadotechnology","html_url":"https://github.com/ocadotechnology","followers_url":"https://api.github.com/users/ocadotechnology/followers","following_url":"https://api.github.com/users/ocadotechnology/following{/other_user}","gists_url":"https://api.github.com/users/ocadotechnology/gists{/gist_id}","starred_url":"https://api.github.com/users/ocadotechnology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocadotechnology/subscriptions","organizations_url":"https://api.github.com/users/ocadotechnology/orgs","repos_url":"https://api.github.com/users/ocadotechnology/repos","events_url":"https://api.github.com/users/ocadotechnology/events{/privacy}","received_events_url":"https://api.github.com/users/ocadotechnology/received_events","type":"Organization","site_admin":false},"repo":{"id":47334865,"name":"hexagonjs","full_name":"ocadotechnology/hexagonjs","owner":{"login":"ocadotechnology","id":2088731,"avatar_url":"https://avatars.githubusercontent.com/u/2088731?v=3","gravatar_id":"","url":"https://api.github.com/users/ocadotechnology","html_url":"https://github.com/ocadotechnology","followers_url":"https://api.github.com/users/ocadotechnology/followers","following_url":"https://api.github.com/users/ocadotechnology/following{/other_user}","gists_url":"https://api.github.com/users/ocadotechnology/gists{/gist_id}","starred_url":"https://api.github.com/users/ocadotechnology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocadotechnology/subscriptions","organizations_url":"https://api.github.com/users/ocadotechnology/orgs","repos_url":"https://api.github.com/users/ocadotechnology/repos","events_url":"https://api.github.com/users/ocadotechnology/events{/privacy}","received_events_url":"https://api.github.com/users/ocadotechnology/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocadotechnology/hexagonjs","description":"A modular, themable collection of components for modern browsers","fork":false,"url":"https://api.github.com/repos/ocadotechnology/hexagonjs","forks_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/forks","keys_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/teams","hooks_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/hooks","issue_events_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/events{/number}","events_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/events","assignees_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/assignees{/user}","branches_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/branches{/branch}","tags_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/tags","blobs_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/statuses/{sha}","languages_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/languages","stargazers_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/stargazers","contributors_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/contributors","subscribers_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/subscribers","subscription_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/subscription","commits_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/contents/{+path}","compare_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/merges","archive_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/downloads","issues_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues{/number}","pulls_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls{/number}","milestones_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/milestones{/number}","notifications_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/labels{/name}","releases_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/releases{/id}","deployments_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/deployments","created_at":"2015-12-03T13:49:12Z","updated_at":"2016-09-02T23:13:04Z","pushed_at":"2016-10-12T10:40:10Z","git_url":"git://github.com/ocadotechnology/hexagonjs.git","ssh_url":"git@github.com:ocadotechnology/hexagonjs.git","clone_url":"https://github.com/ocadotechnology/hexagonjs.git","svn_url":"https://github.com/ocadotechnology/hexagonjs","homepage":"https://www.hexagonjs.io","size":2386,"stargazers_count":40,"watchers_count":40,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":117,"forks":11,"open_issues":117,"watchers":40,"default_branch":"master"}},"base":{"label":"ocadotechnology:master","ref":"master","sha":"284b343c114a905db5d24d252f1ca9a0c58a469d","user":{"login":"ocadotechnology","id":2088731,"avatar_url":"https://avatars.githubusercontent.com/u/2088731?v=3","gravatar_id":"","url":"https://api.github.com/users/ocadotechnology","html_url":"https://github.com/ocadotechnology","followers_url":"https://api.github.com/users/ocadotechnology/followers","following_url":"https://api.github.com/users/ocadotechnology/following{/other_user}","gists_url":"https://api.github.com/users/ocadotechnology/gists{/gist_id}","starred_url":"https://api.github.com/users/ocadotechnology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocadotechnology/subscriptions","organizations_url":"https://api.github.com/users/ocadotechnology/orgs","repos_url":"https://api.github.com/users/ocadotechnology/repos","events_url":"https://api.github.com/users/ocadotechnology/events{/privacy}","received_events_url":"https://api.github.com/users/ocadotechnology/received_events","type":"Organization","site_admin":false},"repo":{"id":47334865,"name":"hexagonjs","full_name":"ocadotechnology/hexagonjs","owner":{"login":"ocadotechnology","id":2088731,"avatar_url":"https://avatars.githubusercontent.com/u/2088731?v=3","gravatar_id":"","url":"https://api.github.com/users/ocadotechnology","html_url":"https://github.com/ocadotechnology","followers_url":"https://api.github.com/users/ocadotechnology/followers","following_url":"https://api.github.com/users/ocadotechnology/following{/other_user}","gists_url":"https://api.github.com/users/ocadotechnology/gists{/gist_id}","starred_url":"https://api.github.com/users/ocadotechnology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocadotechnology/subscriptions","organizations_url":"https://api.github.com/users/ocadotechnology/orgs","repos_url":"https://api.github.com/users/ocadotechnology/repos","events_url":"https://api.github.com/users/ocadotechnology/events{/privacy}","received_events_url":"https://api.github.com/users/ocadotechnology/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocadotechnology/hexagonjs","description":"A modular, themable collection of components for modern browsers","fork":false,"url":"https://api.github.com/repos/ocadotechnology/hexagonjs","forks_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/forks","keys_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/teams","hooks_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/hooks","issue_events_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/events{/number}","events_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/events","assignees_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/assignees{/user}","branches_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/branches{/branch}","tags_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/tags","blobs_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/statuses/{sha}","languages_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/languages","stargazers_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/stargazers","contributors_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/contributors","subscribers_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/subscribers","subscription_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/subscription","commits_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/contents/{+path}","compare_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/merges","archive_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/downloads","issues_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues{/number}","pulls_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls{/number}","milestones_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/milestones{/number}","notifications_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/labels{/name}","releases_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/releases{/id}","deployments_url":"https://api.github.com/repos/ocadotechnology/hexagonjs/deployments","created_at":"2015-12-03T13:49:12Z","updated_at":"2016-09-02T23:13:04Z","pushed_at":"2016-10-12T10:40:10Z","git_url":"git://github.com/ocadotechnology/hexagonjs.git","ssh_url":"git@github.com:ocadotechnology/hexagonjs.git","clone_url":"https://github.com/ocadotechnology/hexagonjs.git","svn_url":"https://github.com/ocadotechnology/hexagonjs","homepage":"https://www.hexagonjs.io","size":2386,"stargazers_count":40,"watchers_count":40,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":117,"forks":11,"open_issues":117,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340"},"html":{"href":"https://github.com/ocadotechnology/hexagonjs/pull/340"},"issue":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/340"},"comments":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/issues/340/comments"},"review_comments":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340/comments"},"review_comment":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/pulls/340/commits"},"statuses":{"href":"https://api.github.com/repos/ocadotechnology/hexagonjs/statuses/5c542a7e1a5cd3775440613747bd8ea36b5cb8ec"}}}}
{"actor":{"display_login":"c-frater"}}