{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1829","repository_url":"https://api.github.com/repos/ReactiveX/rxjs","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1829/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1829/comments","events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1829/events","html_url":"https://github.com/ReactiveX/rxjs/issues/1829","id":165506790,"number":1829,"title":"Extending Observable","user":{"login":"trxcllnt","id":178183,"avatar_url":"https://avatars.githubusercontent.com/u/178183?v=3","gravatar_id":"","url":"https://api.github.com/users/trxcllnt","html_url":"https://github.com/trxcllnt","followers_url":"https://api.github.com/users/trxcllnt/followers","following_url":"https://api.github.com/users/trxcllnt/following{/other_user}","gists_url":"https://api.github.com/users/trxcllnt/gists{/gist_id}","starred_url":"https://api.github.com/users/trxcllnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trxcllnt/subscriptions","organizations_url":"https://api.github.com/users/trxcllnt/orgs","repos_url":"https://api.github.com/users/trxcllnt/repos","events_url":"https://api.github.com/users/trxcllnt/events{/privacy}","received_events_url":"https://api.github.com/users/trxcllnt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ReactiveX/rxjs/labels/type:%20discussion","name":"type: discussion","color":"207de5"},{"url":"https://api.github.com/repos/ReactiveX/rxjs/labels/type:%20enhancement","name":"type: enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"trxcllnt","id":178183,"avatar_url":"https://avatars.githubusercontent.com/u/178183?v=3","gravatar_id":"","url":"https://api.github.com/users/trxcllnt","html_url":"https://github.com/trxcllnt","followers_url":"https://api.github.com/users/trxcllnt/followers","following_url":"https://api.github.com/users/trxcllnt/following{/other_user}","gists_url":"https://api.github.com/users/trxcllnt/gists{/gist_id}","starred_url":"https://api.github.com/users/trxcllnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trxcllnt/subscriptions","organizations_url":"https://api.github.com/users/trxcllnt/orgs","repos_url":"https://api.github.com/users/trxcllnt/repos","events_url":"https://api.github.com/users/trxcllnt/events{/privacy}","received_events_url":"https://api.github.com/users/trxcllnt/received_events","type":"User","site_admin":false},"assignees":[{"login":"trxcllnt","id":178183,"avatar_url":"https://avatars.githubusercontent.com/u/178183?v=3","gravatar_id":"","url":"https://api.github.com/users/trxcllnt","html_url":"https://github.com/trxcllnt","followers_url":"https://api.github.com/users/trxcllnt/followers","following_url":"https://api.github.com/users/trxcllnt/following{/other_user}","gists_url":"https://api.github.com/users/trxcllnt/gists{/gist_id}","starred_url":"https://api.github.com/users/trxcllnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trxcllnt/subscriptions","organizations_url":"https://api.github.com/users/trxcllnt/orgs","repos_url":"https://api.github.com/users/trxcllnt/repos","events_url":"https://api.github.com/users/trxcllnt/events{/privacy}","received_events_url":"https://api.github.com/users/trxcllnt/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-07-14T08:31:45Z","updated_at":"2016-08-11T20:17:22Z","closed_at":null,"body":"I think we're mature enough to start looking at this closer. As requested before (#1124, #1207, #1353, #1757), extending Observable should be seamless. Most of the time extending Observable and overriding `lift` does the job, but there are a few cases this breaks down.\r\n\r\nIf this sounds reasonable, I'll start work on a PR in the next few days.\r\n\r\n#### Operators that call static methods\r\nThese are combineLatest, concat, merge, race, and zip. Implementing these with `lift` might be tedious, but doable.\r\n\r\n#### Multicast/ConnectableObservable, and operators that emit inner Observables\r\n1. We should implement `multicast` with selector as an operator instead of a custom Observable subclass.\r\n2. `ConnectableObservable`, window, groupBy, and eventually join/groupJoin, should all use the prototype from the current `this` binding, and we can mixin their respective prototypes with `Object.create`. Fortunately, the `ConnectableObservable` implementation is already written with Operators and Subscribers, so aside from the public `multicast` method, this shouldn't be a lot of rework:\r\n\r\n```es6\r\nclass Observable {\r\n  multicast(subjectFactory) {\r\n    const connectable = Object.create(this, connectableObservableDescriptor);\r\n    connectable.subjectFactory = subjectFactory;\r\n    return connectable;\r\n  }\r\n}\r\nconst connectableObservableDescriptor = {\r\n  connect: { value: function () { /* ... */} },\r\n  refCount: { value: function () { /* ... */ } },\r\n  _subscribe: { value: function _subscribe(subscriber) {\r\n      return this.getSubject().subscribe(subscriber);\r\n    }\r\n  },\r\n  getSubject: { value: function getSubject() {\r\n      const subject = this._subject;\r\n      if (!subject || subject.isStopped) {\r\n        this._subject = this.subjectFactory();\r\n      }\r\n      return this._subject;\r\n    }\r\n  }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments/239278815","html_url":"https://github.com/ReactiveX/rxjs/issues/1829#issuecomment-239278815","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1829","id":239278815,"user":{"login":"jayphelps","id":762949,"avatar_url":"https://avatars.githubusercontent.com/u/762949?v=3","gravatar_id":"","url":"https://api.github.com/users/jayphelps","html_url":"https://github.com/jayphelps","followers_url":"https://api.github.com/users/jayphelps/followers","following_url":"https://api.github.com/users/jayphelps/following{/other_user}","gists_url":"https://api.github.com/users/jayphelps/gists{/gist_id}","starred_url":"https://api.github.com/users/jayphelps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayphelps/subscriptions","organizations_url":"https://api.github.com/users/jayphelps/orgs","repos_url":"https://api.github.com/users/jayphelps/repos","events_url":"https://api.github.com/users/jayphelps/events{/privacy}","received_events_url":"https://api.github.com/users/jayphelps/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T20:17:22Z","updated_at":"2016-08-11T20:17:22Z","body":"Regarding `this.lift.call()` that I proposed, that obviously wouldn't solve the static operator issue, i.e. `Observable.merge`, etc where this is no instance prototype to look up `this.lift()`\r\n\r\nWhat about making lift a static method, so static operators can access it and instance operators can access it as well via `this.constructor.lift()`?\r\n\r\n```js\r\nclass Observable {\r\n  static lift() {\r\n    ...\r\n  }\r\n  \r\n  map(...) {\r\n    this.constructor.lift(...);\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"jayphelps"}}