{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular/pulls/comments/43227657","id":43227657,"diff_hunk":"@@ -105,19 +98,32 @@ export class EventEmitter extends Observable {\n     this._isAsync = isAsync;\n   }\n \n-  observer(generator: any): any {\n-    var schedulerFn = this._isAsync ? (value) => { setTimeout(() => generator.next(value)); } :\n-                                      (value) => { generator.next(value); };\n-    return this._subject.subscribe(schedulerFn,\n-                                   (error) => generator.throw ? generator.throw(error) : null,\n-                                   () => generator.return ? generator.return () : null);\n+  subscribe(generatorOrNext?: any, error?: any, complete?: any): any {\n+    if (generatorOrNext && typeof generatorOrNext === 'object') {\n+      let schedulerFn = this._isAsync ?\n+                            (value) => { setTimeout(() => generatorOrNext.next(value)); } :\n+                            (value) => { generatorOrNext.next(value); };\n+      return super.subscribe(schedulerFn,\n+                             (err) => generatorOrNext.error ? generatorOrNext.error(err) : null,\n+                             () => generatorOrNext.complete ? generatorOrNext.complete() : null);\n+    } else {\n+      let schedulerFn = this._isAsync ? (value) => { setTimeout(() => generatorOrNext(value)); } :\n+                                        (value) => { generatorOrNext(value); };\n+\n+      return super.subscribe(schedulerFn, (err) => error ? error(err) : null,\n+                             () => complete ? complete() : null);\n+    }\n   }\n+}\n \n-  toRx(): any { return this._subject; }\n-\n-  next(value: any) { this._subject.next(value); }\n-\n-  throw(error: any) { this._subject.error(error); }\n-\n-  return (value?: any) { this._subject.complete(); }\n+// todo(robwormald): ts2dart should handle this properly\n+export class Observable<T> extends RxObservable<T> {\n+  lift<T, R>(operator: Operator<T, R>): Observable<T> {\n+    const observable = new Observable();\n+    observable.source = this;\n+    observable.operator = operator;\n+    return observable;\n+  }\n }\n+\n+export {Subject}","path":"modules/angular2/src/core/facade/async.ts","position":108,"original_position":108,"commit_id":"9a04d5482192e7cb2f5c2d62fe810b9c9239623b","original_commit_id":"9a04d5482192e7cb2f5c2d62fe810b9c9239623b","user":{"login":"mprobst","id":7208,"avatar_url":"https://avatars.githubusercontent.com/u/7208?v=3","gravatar_id":"","url":"https://api.github.com/users/mprobst","html_url":"https://github.com/mprobst","followers_url":"https://api.github.com/users/mprobst/followers","following_url":"https://api.github.com/users/mprobst/following{/other_user}","gists_url":"https://api.github.com/users/mprobst/gists{/gist_id}","starred_url":"https://api.github.com/users/mprobst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mprobst/subscriptions","organizations_url":"https://api.github.com/users/mprobst/orgs","repos_url":"https://api.github.com/users/mprobst/repos","events_url":"https://api.github.com/users/mprobst/events{/privacy}","received_events_url":"https://api.github.com/users/mprobst/received_events","type":"User","site_admin":false},"body":"Nit: maybe move closer to the import?","created_at":"2015-10-28T08:29:41Z","updated_at":"2015-10-28T08:29:41Z","html_url":"https://github.com/angular/angular/pull/4893#discussion_r43227657","pull_request_url":"https://api.github.com/repos/angular/angular/pulls/4893","_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/comments/43227657"},"html":{"href":"https://github.com/angular/angular/pull/4893#discussion_r43227657"},"pull_request":{"href":"https://api.github.com/repos/angular/angular/pulls/4893"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/4893","id":48669729,"html_url":"https://github.com/angular/angular/pull/4893","diff_url":"https://github.com/angular/angular/pull/4893.diff","patch_url":"https://github.com/angular/angular/pull/4893.patch","issue_url":"https://api.github.com/repos/angular/angular/issues/4893","number":4893,"state":"open","locked":false,"title":"chore(async): Refactor EventEmitter and Async Facade","user":{"login":"robwormald","id":534930,"avatar_url":"https://avatars.githubusercontent.com/u/534930?v=3","gravatar_id":"","url":"https://api.github.com/users/robwormald","html_url":"https://github.com/robwormald","followers_url":"https://api.github.com/users/robwormald/followers","following_url":"https://api.github.com/users/robwormald/following{/other_user}","gists_url":"https://api.github.com/users/robwormald/gists{/gist_id}","starred_url":"https://api.github.com/users/robwormald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robwormald/subscriptions","organizations_url":"https://api.github.com/users/robwormald/orgs","repos_url":"https://api.github.com/users/robwormald/repos","events_url":"https://api.github.com/users/robwormald/events{/privacy}","received_events_url":"https://api.github.com/users/robwormald/received_events","type":"User","site_admin":false},"body":"Refactor EventEmitter and Async Facade to match ES7 Observable semantics, properly use RxJS typedefs, make EventEmitter inherit from RxJS Subject. Closes #4149.\r\n\r\nBREAKING CHANGE:\r\n- consumers of EventEmitter no longer need to call .toRx()\r\n- EventEmitter is now generic and requires a type - e.g. `EventEmitter<string>`\r\n- EventEmitter and Observable now use the `.subscribe(generatorOrNext, error, complete)` method instead of `.observer(generator)`\r\n- ObservableWrapper uses `callNext/callError/callComplete` instead of `callNext/callThrow/callReturn`\r\n\r\nNotes: \r\n- This uses the RxJS main import path (though not the \"kitchen sink\"), and as such adds a number of methods to the public API (see public_api_spec). Note that Subject and EventEmitter both inherit from Observable and so it's less drastic than it looks in terms of new operators ;-) This is the current best workaround / compromise between having accurate type information and a usable EventEmitter / Observable interface. Reference discussions in https://github.com/angular/angular/issues/4390, and over in Rx https://github.com/ReactiveX/RxJS/issues/468 for a potential middle-term solution. This does add bytes to bundles, though with the incoming changes to bundling this could mostly be mitigated. In my opinion, this gives a better developer experience and we can watch over the beta period how and which operators should define the core. \r\n\r\n- Currently this fails on CI due to the dgeni generation of types not liking Rx's external .d.ts files - see https://github.com/angular/angular/issues/4967 but passes otherwise, and I'll rebase once that clears.\r\n\r\n- It adds a psuedo Subject to the dart async facade that matches the EventEmitter - this could potentially be resolved by changes in ts2dart @mprobst ?\r\n\r\n- tldr: this fixes a number of annoying issues re: developer experience (types and operators with EventEmitter, removes .toRx(), etc) and I think is a reasonable step to land before beta. I have a number of minor fixes (Http typedefs, etc) to follow to further improve said experience. \r\n\r\n","created_at":"2015-10-25T01:48:54Z","updated_at":"2015-10-28T08:29:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7b1420d9d84b7104ca3aedb633c789dd2364bef","assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular/milestones/49","html_url":"https://github.com/angular/angular/milestones/beta-00","labels_url":"https://api.github.com/repos/angular/angular/milestones/49/labels","id":1339148,"number":49,"title":"beta-00","description":"Issue which must close before we declare beta.","creator":{"login":"naomiblack","id":2286589,"avatar_url":"https://avatars.githubusercontent.com/u/2286589?v=3","gravatar_id":"","url":"https://api.github.com/users/naomiblack","html_url":"https://github.com/naomiblack","followers_url":"https://api.github.com/users/naomiblack/followers","following_url":"https://api.github.com/users/naomiblack/following{/other_user}","gists_url":"https://api.github.com/users/naomiblack/gists{/gist_id}","starred_url":"https://api.github.com/users/naomiblack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naomiblack/subscriptions","organizations_url":"https://api.github.com/users/naomiblack/orgs","repos_url":"https://api.github.com/users/naomiblack/repos","events_url":"https://api.github.com/users/naomiblack/events{/privacy}","received_events_url":"https://api.github.com/users/naomiblack/received_events","type":"User","site_admin":false},"open_issues":53,"closed_issues":18,"state":"open","created_at":"2015-10-05T21:32:20Z","updated_at":"2015-10-28T04:16:46Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/angular/angular/pulls/4893/commits","review_comments_url":"https://api.github.com/repos/angular/angular/pulls/4893/comments","review_comment_url":"https://api.github.com/repos/angular/angular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular/issues/4893/comments","statuses_url":"https://api.github.com/repos/angular/angular/statuses/9a04d5482192e7cb2f5c2d62fe810b9c9239623b","head":{"label":"robwormald:eventemit","ref":"eventemit","sha":"9a04d5482192e7cb2f5c2d62fe810b9c9239623b","user":{"login":"robwormald","id":534930,"avatar_url":"https://avatars.githubusercontent.com/u/534930?v=3","gravatar_id":"","url":"https://api.github.com/users/robwormald","html_url":"https://github.com/robwormald","followers_url":"https://api.github.com/users/robwormald/followers","following_url":"https://api.github.com/users/robwormald/following{/other_user}","gists_url":"https://api.github.com/users/robwormald/gists{/gist_id}","starred_url":"https://api.github.com/users/robwormald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robwormald/subscriptions","organizations_url":"https://api.github.com/users/robwormald/orgs","repos_url":"https://api.github.com/users/robwormald/repos","events_url":"https://api.github.com/users/robwormald/events{/privacy}","received_events_url":"https://api.github.com/users/robwormald/received_events","type":"User","site_admin":false},"repo":{"id":37181902,"name":"angular","full_name":"robwormald/angular","owner":{"login":"robwormald","id":534930,"avatar_url":"https://avatars.githubusercontent.com/u/534930?v=3","gravatar_id":"","url":"https://api.github.com/users/robwormald","html_url":"https://github.com/robwormald","followers_url":"https://api.github.com/users/robwormald/followers","following_url":"https://api.github.com/users/robwormald/following{/other_user}","gists_url":"https://api.github.com/users/robwormald/gists{/gist_id}","starred_url":"https://api.github.com/users/robwormald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robwormald/subscriptions","organizations_url":"https://api.github.com/users/robwormald/orgs","repos_url":"https://api.github.com/users/robwormald/repos","events_url":"https://api.github.com/users/robwormald/events{/privacy}","received_events_url":"https://api.github.com/users/robwormald/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robwormald/angular","description":"","fork":true,"url":"https://api.github.com/repos/robwormald/angular","forks_url":"https://api.github.com/repos/robwormald/angular/forks","keys_url":"https://api.github.com/repos/robwormald/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robwormald/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robwormald/angular/teams","hooks_url":"https://api.github.com/repos/robwormald/angular/hooks","issue_events_url":"https://api.github.com/repos/robwormald/angular/issues/events{/number}","events_url":"https://api.github.com/repos/robwormald/angular/events","assignees_url":"https://api.github.com/repos/robwormald/angular/assignees{/user}","branches_url":"https://api.github.com/repos/robwormald/angular/branches{/branch}","tags_url":"https://api.github.com/repos/robwormald/angular/tags","blobs_url":"https://api.github.com/repos/robwormald/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robwormald/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robwormald/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/robwormald/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robwormald/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/robwormald/angular/languages","stargazers_url":"https://api.github.com/repos/robwormald/angular/stargazers","contributors_url":"https://api.github.com/repos/robwormald/angular/contributors","subscribers_url":"https://api.github.com/repos/robwormald/angular/subscribers","subscription_url":"https://api.github.com/repos/robwormald/angular/subscription","commits_url":"https://api.github.com/repos/robwormald/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/robwormald/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/robwormald/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/robwormald/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/robwormald/angular/contents/{+path}","compare_url":"https://api.github.com/repos/robwormald/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robwormald/angular/merges","archive_url":"https://api.github.com/repos/robwormald/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robwormald/angular/downloads","issues_url":"https://api.github.com/repos/robwormald/angular/issues{/number}","pulls_url":"https://api.github.com/repos/robwormald/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/robwormald/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/robwormald/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robwormald/angular/labels{/name}","releases_url":"https://api.github.com/repos/robwormald/angular/releases{/id}","created_at":"2015-06-10T07:22:08Z","updated_at":"2015-06-10T07:22:10Z","pushed_at":"2015-10-28T03:07:36Z","git_url":"git://github.com/robwormald/angular.git","ssh_url":"git@github.com:robwormald/angular.git","clone_url":"https://github.com/robwormald/angular.git","svn_url":"https://github.com/robwormald/angular","homepage":null,"size":17584,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"angular:master","ref":"master","sha":"137549d010cdf4c1b3b428d561f198243b8a3fe3","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":24195339,"name":"angular","full_name":"angular/angular","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/angular","description":"","fork":false,"url":"https://api.github.com/repos/angular/angular","forks_url":"https://api.github.com/repos/angular/angular/forks","keys_url":"https://api.github.com/repos/angular/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular/teams","hooks_url":"https://api.github.com/repos/angular/angular/hooks","issue_events_url":"https://api.github.com/repos/angular/angular/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular/events","assignees_url":"https://api.github.com/repos/angular/angular/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular/tags","blobs_url":"https://api.github.com/repos/angular/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular/languages","stargazers_url":"https://api.github.com/repos/angular/angular/stargazers","contributors_url":"https://api.github.com/repos/angular/angular/contributors","subscribers_url":"https://api.github.com/repos/angular/angular/subscribers","subscription_url":"https://api.github.com/repos/angular/angular/subscription","commits_url":"https://api.github.com/repos/angular/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular/merges","archive_url":"https://api.github.com/repos/angular/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular/downloads","issues_url":"https://api.github.com/repos/angular/angular/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular/releases{/id}","created_at":"2014-09-18T16:12:01Z","updated_at":"2015-10-28T07:38:42Z","pushed_at":"2015-10-28T07:59:29Z","git_url":"git://github.com/angular/angular.git","ssh_url":"git@github.com:angular/angular.git","clone_url":"https://github.com/angular/angular.git","svn_url":"https://github.com/angular/angular","homepage":"https://angular.io","size":67311,"stargazers_count":6097,"watchers_count":6097,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1650,"mirror_url":null,"open_issues_count":583,"forks":1650,"open_issues":583,"watchers":6097,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/4893"},"html":{"href":"https://github.com/angular/angular/pull/4893"},"issue":{"href":"https://api.github.com/repos/angular/angular/issues/4893"},"comments":{"href":"https://api.github.com/repos/angular/angular/issues/4893/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular/pulls/4893/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular/pulls/4893/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular/statuses/9a04d5482192e7cb2f5c2d62fe810b9c9239623b"}}}}