{"action":"closed","number":6064,"pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/6064","id":29233751,"html_url":"https://github.com/mrdoob/three.js/pull/6064","diff_url":"https://github.com/mrdoob/three.js/pull/6064.diff","patch_url":"https://github.com/mrdoob/three.js/pull/6064.patch","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/6064","number":6064,"state":"closed","locked":false,"title":"Safe EventDispatcher","user":{"login":"greggman","id":234804,"avatar_url":"https://avatars.githubusercontent.com/u/234804?v=3","gravatar_id":"","url":"https://api.github.com/users/greggman","html_url":"https://github.com/greggman","followers_url":"https://api.github.com/users/greggman/followers","following_url":"https://api.github.com/users/greggman/following{/other_user}","gists_url":"https://api.github.com/users/greggman/gists{/gist_id}","starred_url":"https://api.github.com/users/greggman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggman/subscriptions","organizations_url":"https://api.github.com/users/greggman/orgs","repos_url":"https://api.github.com/users/greggman/repos","events_url":"https://api.github.com/users/greggman/events{/privacy}","received_events_url":"https://api.github.com/users/greggman/received_events","type":"User","site_admin":false},"body":"This is just a suggestion. \r\n\r\nThe current implementation of EventDispatcher is intrusive. It sticks `_listeners` on\r\nobject it's being added to. If that object already has a `_listeners` your out of luck.\r\n\r\nAbove is a non intrusive implementation for your consideration. The `listeners`\r\ncollection is not public whatsoever.\r\n\r\nI [tested them on jsperf and it's the same speed on chrome and significantly faster\r\non Firefox](http://jsperf.com/event-dispatching)\r\n\r\nI didn't expose `dispatchEvent` to the public API of `TypedGeometry` because it\r\nseemed to me users of `TypedGeometry` shouldn't be able to dispatch events but\r\nof course that could be exposed too.\r\n\r\nAnyway, just passing it on as a suggestion. I'm learning JS as I go and finding that what I learned\r\nat Google was wrong :P  They use their Closure Compiler and they basically\r\ntreat JavaScript like Java and expect the compiler to make things semi safe but\r\nJavaScript can be safe all by itself so I'm slowly learing more JavaScripty\r\nways.","created_at":"2015-02-13T01:39:03Z","updated_at":"2015-10-15T23:58:43Z","closed_at":"2015-10-15T23:58:43Z","merged_at":null,"merge_commit_sha":"4661223dc0f2ca3ff20ab84fce307c0f0bf24d8e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mrdoob/three.js/pulls/6064/commits","review_comments_url":"https://api.github.com/repos/mrdoob/three.js/pulls/6064/comments","review_comment_url":"https://api.github.com/repos/mrdoob/three.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/6064/comments","statuses_url":"https://api.github.com/repos/mrdoob/three.js/statuses/856f4b02cb866ac9b01aa2b4ac496ffd661ef090","head":{"label":"greggman:safe-event-dispatcher","ref":"safe-event-dispatcher","sha":"856f4b02cb866ac9b01aa2b4ac496ffd661ef090","user":{"login":"greggman","id":234804,"avatar_url":"https://avatars.githubusercontent.com/u/234804?v=3","gravatar_id":"","url":"https://api.github.com/users/greggman","html_url":"https://github.com/greggman","followers_url":"https://api.github.com/users/greggman/followers","following_url":"https://api.github.com/users/greggman/following{/other_user}","gists_url":"https://api.github.com/users/greggman/gists{/gist_id}","starred_url":"https://api.github.com/users/greggman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggman/subscriptions","organizations_url":"https://api.github.com/users/greggman/orgs","repos_url":"https://api.github.com/users/greggman/repos","events_url":"https://api.github.com/users/greggman/events{/privacy}","received_events_url":"https://api.github.com/users/greggman/received_events","type":"User","site_admin":false},"repo":{"id":1834848,"name":"three.js","full_name":"greggman/three.js","owner":{"login":"greggman","id":234804,"avatar_url":"https://avatars.githubusercontent.com/u/234804?v=3","gravatar_id":"","url":"https://api.github.com/users/greggman","html_url":"https://github.com/greggman","followers_url":"https://api.github.com/users/greggman/followers","following_url":"https://api.github.com/users/greggman/following{/other_user}","gists_url":"https://api.github.com/users/greggman/gists{/gist_id}","starred_url":"https://api.github.com/users/greggman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggman/subscriptions","organizations_url":"https://api.github.com/users/greggman/orgs","repos_url":"https://api.github.com/users/greggman/repos","events_url":"https://api.github.com/users/greggman/events{/privacy}","received_events_url":"https://api.github.com/users/greggman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/greggman/three.js","description":"Javascript 3D Engine","fork":true,"url":"https://api.github.com/repos/greggman/three.js","forks_url":"https://api.github.com/repos/greggman/three.js/forks","keys_url":"https://api.github.com/repos/greggman/three.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greggman/three.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greggman/three.js/teams","hooks_url":"https://api.github.com/repos/greggman/three.js/hooks","issue_events_url":"https://api.github.com/repos/greggman/three.js/issues/events{/number}","events_url":"https://api.github.com/repos/greggman/three.js/events","assignees_url":"https://api.github.com/repos/greggman/three.js/assignees{/user}","branches_url":"https://api.github.com/repos/greggman/three.js/branches{/branch}","tags_url":"https://api.github.com/repos/greggman/three.js/tags","blobs_url":"https://api.github.com/repos/greggman/three.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greggman/three.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greggman/three.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/greggman/three.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greggman/three.js/statuses/{sha}","languages_url":"https://api.github.com/repos/greggman/three.js/languages","stargazers_url":"https://api.github.com/repos/greggman/three.js/stargazers","contributors_url":"https://api.github.com/repos/greggman/three.js/contributors","subscribers_url":"https://api.github.com/repos/greggman/three.js/subscribers","subscription_url":"https://api.github.com/repos/greggman/three.js/subscription","commits_url":"https://api.github.com/repos/greggman/three.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/greggman/three.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/greggman/three.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/greggman/three.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/greggman/three.js/contents/{+path}","compare_url":"https://api.github.com/repos/greggman/three.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greggman/three.js/merges","archive_url":"https://api.github.com/repos/greggman/three.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greggman/three.js/downloads","issues_url":"https://api.github.com/repos/greggman/three.js/issues{/number}","pulls_url":"https://api.github.com/repos/greggman/three.js/pulls{/number}","milestones_url":"https://api.github.com/repos/greggman/three.js/milestones{/number}","notifications_url":"https://api.github.com/repos/greggman/three.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greggman/three.js/labels{/name}","releases_url":"https://api.github.com/repos/greggman/three.js/releases{/id}","created_at":"2011-06-02T00:16:12Z","updated_at":"2015-04-20T13:54:52Z","pushed_at":"2015-07-01T18:05:27Z","git_url":"git://github.com/greggman/three.js.git","ssh_url":"git@github.com:greggman/three.js.git","clone_url":"https://github.com/greggman/three.js.git","svn_url":"https://github.com/greggman/three.js","homepage":"","size":314432,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"mrdoob:dev","ref":"dev","sha":"c6e69f22561148453c5d0974344b5158e6e30074","user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"repo":{"id":576201,"name":"three.js","full_name":"mrdoob/three.js","owner":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrdoob/three.js","description":"JavaScript 3D library.","fork":false,"url":"https://api.github.com/repos/mrdoob/three.js","forks_url":"https://api.github.com/repos/mrdoob/three.js/forks","keys_url":"https://api.github.com/repos/mrdoob/three.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrdoob/three.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrdoob/three.js/teams","hooks_url":"https://api.github.com/repos/mrdoob/three.js/hooks","issue_events_url":"https://api.github.com/repos/mrdoob/three.js/issues/events{/number}","events_url":"https://api.github.com/repos/mrdoob/three.js/events","assignees_url":"https://api.github.com/repos/mrdoob/three.js/assignees{/user}","branches_url":"https://api.github.com/repos/mrdoob/three.js/branches{/branch}","tags_url":"https://api.github.com/repos/mrdoob/three.js/tags","blobs_url":"https://api.github.com/repos/mrdoob/three.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrdoob/three.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrdoob/three.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrdoob/three.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrdoob/three.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mrdoob/three.js/languages","stargazers_url":"https://api.github.com/repos/mrdoob/three.js/stargazers","contributors_url":"https://api.github.com/repos/mrdoob/three.js/contributors","subscribers_url":"https://api.github.com/repos/mrdoob/three.js/subscribers","subscription_url":"https://api.github.com/repos/mrdoob/three.js/subscription","commits_url":"https://api.github.com/repos/mrdoob/three.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrdoob/three.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrdoob/three.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrdoob/three.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrdoob/three.js/contents/{+path}","compare_url":"https://api.github.com/repos/mrdoob/three.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrdoob/three.js/merges","archive_url":"https://api.github.com/repos/mrdoob/three.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrdoob/three.js/downloads","issues_url":"https://api.github.com/repos/mrdoob/three.js/issues{/number}","pulls_url":"https://api.github.com/repos/mrdoob/three.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mrdoob/three.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mrdoob/three.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrdoob/three.js/labels{/name}","releases_url":"https://api.github.com/repos/mrdoob/three.js/releases{/id}","created_at":"2010-03-23T18:58:01Z","updated_at":"2015-10-15T23:36:22Z","pushed_at":"2015-10-15T23:47:52Z","git_url":"git://github.com/mrdoob/three.js.git","ssh_url":"git@github.com:mrdoob/three.js.git","clone_url":"https://github.com/mrdoob/three.js.git","svn_url":"https://github.com/mrdoob/three.js","homepage":"http://threejs.org/","size":421275,"stargazers_count":21525,"watchers_count":21525,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":6660,"mirror_url":null,"open_issues_count":521,"forks":6660,"open_issues":521,"watchers":21525,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6064"},"html":{"href":"https://github.com/mrdoob/three.js/pull/6064"},"issue":{"href":"https://api.github.com/repos/mrdoob/three.js/issues/6064"},"comments":{"href":"https://api.github.com/repos/mrdoob/three.js/issues/6064/comments"},"review_comments":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6064/comments"},"review_comment":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/6064/commits"},"statuses":{"href":"https://api.github.com/repos/mrdoob/three.js/statuses/856f4b02cb866ac9b01aa2b4ac496ffd661ef090"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":8,"review_comments":0,"commits":1,"additions":38,"deletions":51,"changed_files":2}}