{"action":"created","comment":{"url":"https://api.github.com/repos/ably/docs/pulls/comments/52337889","id":52337889,"diff_hunk":"@@ -482,11 +482,11 @@ h3(#realtime-presence). Presence\n \n h3(#eventemitter). EventEmitter mixin / interface\n \n-* @(RTE1)@ @EventEmitter@ is a generic interface for event registration and delivery used in a number of the types in the Realtime client library.  For example, the @Connection@ object emits events for connection state using the @EventEmitter@ pattern\n+* @(RTE1)@ @EventEmitter@ is a generic interface for event registration and delivery used in a number of the types in the Realtime client library. For example, the @Connection@ object emits events for connection state using the @EventEmitter@ pattern\n * @(RTE2)@ Where objects provide @subscribe@ or @unsubscribe@ methods, they should follow the specification for the @EventEmitter#on@ and @EventEmitter#off@ methods respectively\n-* @(RTE3)@ @EventEmitter#on@ registers a listener for the specified event if provided, else it is registered for all events\n-* @(RTE4)@ @EventEmitter#once@ registers a listener that is called only once when the first of the applicable events occurs (ie the specified event if given, or the first event if it is registered for all events)\n-* @(RTE5)@ @EventEmitter#off@ deregisters a listener for the specified event if given, else it is deregisters that listener for all registrations (global and event-specific)\n+* @(RTE3)@ @EventEmitter#on@ allows a listener to be registered for either all events when no event argument is provided, or for only a single type of event when an event argument is provided. If @on@ is called twice with the exact same arguments, two listeners are added to the array of registered listeners. Therefore, it is perfectly valid to register the same listener multiple times and expect the listener to be called multiple times for each event emitted","path":"content/client-lib-development-guide/features.textile","position":10,"original_position":10,"commit_id":"86b2f306d79dc6e3e3b088c27720cdb2b92455ef","original_commit_id":"86b2f306d79dc6e3e3b088c27720cdb2b92455ef","user":{"login":"tcard","id":727422,"avatar_url":"https://avatars.githubusercontent.com/u/727422?v=3","gravatar_id":"","url":"https://api.github.com/users/tcard","html_url":"https://github.com/tcard","followers_url":"https://api.github.com/users/tcard/followers","following_url":"https://api.github.com/users/tcard/following{/other_user}","gists_url":"https://api.github.com/users/tcard/gists{/gist_id}","starred_url":"https://api.github.com/users/tcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcard/subscriptions","organizations_url":"https://api.github.com/users/tcard/orgs","repos_url":"https://api.github.com/users/tcard/repos","events_url":"https://api.github.com/users/tcard/events{/privacy}","received_events_url":"https://api.github.com/users/tcard/received_events","type":"User","site_admin":false},"body":"\"If @on@ is called twice with the exact same arguments, two listeners are added to the array of registered listeners.\" I think this is a bit confusing way of putting it; now what constitutes a listener is even more diffuse, as what we treat like the _same_ listener in one place results in _two_ listeners here. \"Array\" also isn't particularly helpful in describing this.\r\n\r\nMaybe it could be mentioned that the EventEmitter keeps a _registry_, each entry in the registry is called a _registration_ as has a listener and possibly a specific event type, and several _independent_ registrations can be made for the _same listener_.","created_at":"2016-02-09T16:59:51Z","updated_at":"2016-02-09T16:59:51Z","html_url":"https://github.com/ably/docs/pull/85#discussion_r52337889","pull_request_url":"https://api.github.com/repos/ably/docs/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/ably/docs/pulls/comments/52337889"},"html":{"href":"https://github.com/ably/docs/pull/85#discussion_r52337889"},"pull_request":{"href":"https://api.github.com/repos/ably/docs/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/ably/docs/pulls/85","id":58724711,"html_url":"https://github.com/ably/docs/pull/85","diff_url":"https://github.com/ably/docs/pull/85.diff","patch_url":"https://github.com/ably/docs/pull/85.patch","issue_url":"https://api.github.com/repos/ably/docs/issues/85","number":85,"state":"open","locked":false,"title":"spec: Clarify EventEmitter spec","user":{"login":"mattheworiordan","id":43789,"avatar_url":"https://avatars.githubusercontent.com/u/43789?v=3","gravatar_id":"","url":"https://api.github.com/users/mattheworiordan","html_url":"https://github.com/mattheworiordan","followers_url":"https://api.github.com/users/mattheworiordan/followers","following_url":"https://api.github.com/users/mattheworiordan/following{/other_user}","gists_url":"https://api.github.com/users/mattheworiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattheworiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattheworiordan/subscriptions","organizations_url":"https://api.github.com/users/mattheworiordan/orgs","repos_url":"https://api.github.com/users/mattheworiordan/repos","events_url":"https://api.github.com/users/mattheworiordan/events{/privacy}","received_events_url":"https://api.github.com/users/mattheworiordan/received_events","type":"User","site_admin":false},"body":"Specifically addressing the ambiguity around whether registrations are sets or arrays, and whether off removes the first match or all matches\r\n\r\n@tcard @paddybyers please review","created_at":"2016-02-09T09:52:41Z","updated_at":"2016-02-09T16:59:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4dabba462b2de77e3b36d2d7693e0aff1eab6f6d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ably/docs/pulls/85/commits","review_comments_url":"https://api.github.com/repos/ably/docs/pulls/85/comments","review_comment_url":"https://api.github.com/repos/ably/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ably/docs/issues/85/comments","statuses_url":"https://api.github.com/repos/ably/docs/statuses/86b2f306d79dc6e3e3b088c27720cdb2b92455ef","head":{"label":"ably:event-emitter-clarification","ref":"event-emitter-clarification","sha":"86b2f306d79dc6e3e3b088c27720cdb2b92455ef","user":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"repo":{"id":7221949,"name":"docs","full_name":"ably/docs","owner":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ably/docs","description":"Ably API documentation ","fork":false,"url":"https://api.github.com/repos/ably/docs","forks_url":"https://api.github.com/repos/ably/docs/forks","keys_url":"https://api.github.com/repos/ably/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ably/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ably/docs/teams","hooks_url":"https://api.github.com/repos/ably/docs/hooks","issue_events_url":"https://api.github.com/repos/ably/docs/issues/events{/number}","events_url":"https://api.github.com/repos/ably/docs/events","assignees_url":"https://api.github.com/repos/ably/docs/assignees{/user}","branches_url":"https://api.github.com/repos/ably/docs/branches{/branch}","tags_url":"https://api.github.com/repos/ably/docs/tags","blobs_url":"https://api.github.com/repos/ably/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ably/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ably/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ably/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ably/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/ably/docs/languages","stargazers_url":"https://api.github.com/repos/ably/docs/stargazers","contributors_url":"https://api.github.com/repos/ably/docs/contributors","subscribers_url":"https://api.github.com/repos/ably/docs/subscribers","subscription_url":"https://api.github.com/repos/ably/docs/subscription","commits_url":"https://api.github.com/repos/ably/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ably/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ably/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ably/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ably/docs/contents/{+path}","compare_url":"https://api.github.com/repos/ably/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ably/docs/merges","archive_url":"https://api.github.com/repos/ably/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ably/docs/downloads","issues_url":"https://api.github.com/repos/ably/docs/issues{/number}","pulls_url":"https://api.github.com/repos/ably/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/ably/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/ably/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ably/docs/labels{/name}","releases_url":"https://api.github.com/repos/ably/docs/releases{/id}","deployments_url":"https://api.github.com/repos/ably/docs/deployments","created_at":"2012-12-18T10:59:49Z","updated_at":"2016-01-13T09:44:51Z","pushed_at":"2016-02-09T16:59:11Z","git_url":"git://github.com/ably/docs.git","ssh_url":"git@github.com:ably/docs.git","clone_url":"https://github.com/ably/docs.git","svn_url":"https://github.com/ably/docs","homepage":null,"size":2349,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":32,"forks":4,"open_issues":32,"watchers":1,"default_branch":"source"}},"base":{"label":"ably:source","ref":"source","sha":"6c0b0762a8ad188faf88a38c1f3311d40e8ae5af","user":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"repo":{"id":7221949,"name":"docs","full_name":"ably/docs","owner":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ably/docs","description":"Ably API documentation ","fork":false,"url":"https://api.github.com/repos/ably/docs","forks_url":"https://api.github.com/repos/ably/docs/forks","keys_url":"https://api.github.com/repos/ably/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ably/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ably/docs/teams","hooks_url":"https://api.github.com/repos/ably/docs/hooks","issue_events_url":"https://api.github.com/repos/ably/docs/issues/events{/number}","events_url":"https://api.github.com/repos/ably/docs/events","assignees_url":"https://api.github.com/repos/ably/docs/assignees{/user}","branches_url":"https://api.github.com/repos/ably/docs/branches{/branch}","tags_url":"https://api.github.com/repos/ably/docs/tags","blobs_url":"https://api.github.com/repos/ably/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ably/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ably/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ably/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ably/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/ably/docs/languages","stargazers_url":"https://api.github.com/repos/ably/docs/stargazers","contributors_url":"https://api.github.com/repos/ably/docs/contributors","subscribers_url":"https://api.github.com/repos/ably/docs/subscribers","subscription_url":"https://api.github.com/repos/ably/docs/subscription","commits_url":"https://api.github.com/repos/ably/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ably/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ably/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ably/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ably/docs/contents/{+path}","compare_url":"https://api.github.com/repos/ably/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ably/docs/merges","archive_url":"https://api.github.com/repos/ably/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ably/docs/downloads","issues_url":"https://api.github.com/repos/ably/docs/issues{/number}","pulls_url":"https://api.github.com/repos/ably/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/ably/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/ably/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ably/docs/labels{/name}","releases_url":"https://api.github.com/repos/ably/docs/releases{/id}","deployments_url":"https://api.github.com/repos/ably/docs/deployments","created_at":"2012-12-18T10:59:49Z","updated_at":"2016-01-13T09:44:51Z","pushed_at":"2016-02-09T16:59:11Z","git_url":"git://github.com/ably/docs.git","ssh_url":"git@github.com:ably/docs.git","clone_url":"https://github.com/ably/docs.git","svn_url":"https://github.com/ably/docs","homepage":null,"size":2349,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":32,"forks":4,"open_issues":32,"watchers":1,"default_branch":"source"}},"_links":{"self":{"href":"https://api.github.com/repos/ably/docs/pulls/85"},"html":{"href":"https://github.com/ably/docs/pull/85"},"issue":{"href":"https://api.github.com/repos/ably/docs/issues/85"},"comments":{"href":"https://api.github.com/repos/ably/docs/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/ably/docs/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/ably/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ably/docs/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/ably/docs/statuses/86b2f306d79dc6e3e3b088c27720cdb2b92455ef"}}}}