{"action":"created","issue":{"url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/845","labels_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/845/labels{/name}","comments_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/845/comments","events_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/845/events","html_url":"https://github.com/Reactive-Extensions/RxJS/issues/845","id":99454113,"number":845,"title":"Extend a spawn method.","user":{"login":"xgrommx","id":1499594,"avatar_url":"https://avatars.githubusercontent.com/u/1499594?v=3","gravatar_id":"","url":"https://api.github.com/users/xgrommx","html_url":"https://github.com/xgrommx","followers_url":"https://api.github.com/users/xgrommx/followers","following_url":"https://api.github.com/users/xgrommx/following{/other_user}","gists_url":"https://api.github.com/users/xgrommx/gists{/gist_id}","starred_url":"https://api.github.com/users/xgrommx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xgrommx/subscriptions","organizations_url":"https://api.github.com/users/xgrommx/orgs","repos_url":"https://api.github.com/users/xgrommx/repos","events_url":"https://api.github.com/users/xgrommx/events{/privacy}","received_events_url":"https://api.github.com/users/xgrommx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-06T14:48:01Z","updated_at":"2015-08-06T16:24:53Z","closed_at":null,"body":"Hello @mattpodwysocki. I look on `Rx.Observable.spawn` and it's awesome that to return `Observable`. But will be better if exists another method like a `wrap` the same as in https://github.com/tj/co/blob/master/index.js#L26. I create a small code like so:\r\n\r\n```js\r\nRx.Observable.wrap = function (fn) {\r\n  createObservable.__generatorFunction__ = fn;\r\n  return createObservable;\r\n  \r\n  function createObservable() {\r\n    return Rx.Observable.spawn.call(this, fn.apply(this, arguments));\r\n  }\r\n};\r\n\r\nvar spawned = Rx.Observable.wrap(function* (val) {\r\n  var v = yield thunk(val);\r\n  var w = yield Rx.Observable.from([24]).first();\r\n  var x = yield Rx.Observable.just(42).delay(1000);\r\n  var y = yield Rx.Observable.just(56);\r\n  var z = yield Promise.resolve(78);\r\n  return v + w + x + y + z;\r\n})(100);\r\n\r\nspawned.subscribe(\r\n  function (x) { console.log('next %s', x); },\r\n  function (e) { console.log('error %s', e); },\r\n  function () { console.log('completed'); }\r\n); // Return -> next 300\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/comments/128426247","html_url":"https://github.com/Reactive-Extensions/RxJS/issues/845#issuecomment-128426247","issue_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/845","id":128426247,"user":{"login":"xgrommx","id":1499594,"avatar_url":"https://avatars.githubusercontent.com/u/1499594?v=3","gravatar_id":"","url":"https://api.github.com/users/xgrommx","html_url":"https://github.com/xgrommx","followers_url":"https://api.github.com/users/xgrommx/followers","following_url":"https://api.github.com/users/xgrommx/following{/other_user}","gists_url":"https://api.github.com/users/xgrommx/gists{/gist_id}","starred_url":"https://api.github.com/users/xgrommx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xgrommx/subscriptions","organizations_url":"https://api.github.com/users/xgrommx/orgs","repos_url":"https://api.github.com/users/xgrommx/repos","events_url":"https://api.github.com/users/xgrommx/events{/privacy}","received_events_url":"https://api.github.com/users/xgrommx/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T16:24:53Z","updated_at":"2015-08-06T16:24:53Z","body":"Also I tried to use like this https://github.com/tj/co#objects but it's doesn't working for `Rx.Observable.spawn`"}}