{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2628","repository_url":"https://api.github.com/repos/ReactiveX/rxjs","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2628/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2628/comments","events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2628/events","html_url":"https://github.com/ReactiveX/rxjs/issues/2628","id":232107473,"number":2628,"title":"Observables cannot be passed between window contexts.","user":{"login":"goldsam","id":5701782,"avatar_url":"https://avatars2.githubusercontent.com/u/5701782?v=3","gravatar_id":"","url":"https://api.github.com/users/goldsam","html_url":"https://github.com/goldsam","followers_url":"https://api.github.com/users/goldsam/followers","following_url":"https://api.github.com/users/goldsam/following{/other_user}","gists_url":"https://api.github.com/users/goldsam/gists{/gist_id}","starred_url":"https://api.github.com/users/goldsam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldsam/subscriptions","organizations_url":"https://api.github.com/users/goldsam/orgs","repos_url":"https://api.github.com/users/goldsam/repos","events_url":"https://api.github.com/users/goldsam/events{/privacy}","received_events_url":"https://api.github.com/users/goldsam/received_events","type":"User","site_admin":false},"labels":[{"id":241635410,"url":"https://api.github.com/repos/ReactiveX/rxjs/labels/type:%20discussion","name":"type: discussion","color":"207de5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-05-29T22:31:50Z","updated_at":"2017-06-23T10:11:44Z","closed_at":null,"body":"**RxJS version:** 5.4\r\n\r\n**Code to reproduce:**\r\n```javascript\r\nif (window.opener) {\r\n  window.myObservable = window.opener.myObservable;\r\n} else {\r\n  window.myObservable = Rx.Observable.of(1, 2, 3);\r\n  window.open(location.href);\r\n}\r\n\r\nwindow.myObservable\r\n  .switchMap(function(x) {\r\n    return Rx.Observable.of(x);\r\n  })\r\n  .subscribe(function(x) {\r\n    console.log(x);\r\n  });\r\n```\r\n\r\n**Expected behavior:**\r\nBoth parent and child window should print 1, 2, 3 to the console.\r\n\r\n**Actual behavior:**\r\nThe child window throws an exception because `myObservable` from the parent window's context cannot be identified as an Observable in the child window's context. \r\n\r\n**Additional information:**\r\nThe issue is caused by a reliance on [`instanceof`](https://github.com/ReactiveX/rxjs/blob/5.4.0/src/util/subscribeToResult.ts#L27) for determining if an object is an Observable which [fails for objects passed between javascript contexts](https://github.com/baconjs/bacon.js/issues/296). Instead, a more robust solution would test for the shape of an Observable, perhaps using a type guard similar to [`isPromise`](https://github.com/ReactiveX/rxjs/blob/5.4.0/src/util/isPromise.ts)\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments/310628029","html_url":"https://github.com/ReactiveX/rxjs/issues/2628#issuecomment-310628029","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2628","id":310628029,"user":{"login":"roysudi","id":29655060,"avatar_url":"https://avatars0.githubusercontent.com/u/29655060?v=3","gravatar_id":"","url":"https://api.github.com/users/roysudi","html_url":"https://github.com/roysudi","followers_url":"https://api.github.com/users/roysudi/followers","following_url":"https://api.github.com/users/roysudi/following{/other_user}","gists_url":"https://api.github.com/users/roysudi/gists{/gist_id}","starred_url":"https://api.github.com/users/roysudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roysudi/subscriptions","organizations_url":"https://api.github.com/users/roysudi/orgs","repos_url":"https://api.github.com/users/roysudi/repos","events_url":"https://api.github.com/users/roysudi/events{/privacy}","received_events_url":"https://api.github.com/users/roysudi/received_events","type":"User","site_admin":false},"created_at":"2017-06-23T10:11:44Z","updated_at":"2017-06-23T10:11:44Z","body":"@benlesh Any help on this would be appreciated, trying to get the exact same piece work for my app - ng4.0, rxjs 5.0.2"}}
{"actor":{"display_login":"roysudi"}}