{"action":"created","issue":{"url":"https://api.github.com/repos/RonB/angular-oboe/issues/3","labels_url":"https://api.github.com/repos/RonB/angular-oboe/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/RonB/angular-oboe/issues/3/comments","events_url":"https://api.github.com/repos/RonB/angular-oboe/issues/3/events","html_url":"https://github.com/RonB/angular-oboe/issues/3","id":60312754,"number":3,"title":"Callback when request has finished","user":{"login":"ArtworkAD","id":524580,"avatar_url":"https://avatars.githubusercontent.com/u/524580?v=3","gravatar_id":"","url":"https://api.github.com/users/ArtworkAD","html_url":"https://github.com/ArtworkAD","followers_url":"https://api.github.com/users/ArtworkAD/followers","following_url":"https://api.github.com/users/ArtworkAD/following{/other_user}","gists_url":"https://api.github.com/users/ArtworkAD/gists{/gist_id}","starred_url":"https://api.github.com/users/ArtworkAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArtworkAD/subscriptions","organizations_url":"https://api.github.com/users/ArtworkAD/orgs","repos_url":"https://api.github.com/users/ArtworkAD/repos","events_url":"https://api.github.com/users/ArtworkAD/events{/privacy}","received_events_url":"https://api.github.com/users/ArtworkAD/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-09T08:38:36Z","updated_at":"2015-03-17T21:04:06Z","closed_at":"2015-03-15T19:31:24Z","body":"@RonB ```Oboe({})``` seems to return the data directly. However is there a way to obtain a promise of the request? Basically I want to get notified when the stream ends. \r\n\r\n------\r\n\r\nSo I had a closer look at https://github.com/RonB/angular-oboe/blob/master/src/angular-oboe.js I think you are coupling data and service too much which leads to having less control over the stream. I would give the developer the control over the promise and prefer this behaviour:\r\n\r\n````\r\nangular.module('ngOboe', []).service('Oboe', [\r\n\t'OboeStream',\r\n\tfunction(OboeStream) {\r\n\t\treturn function(params) {\r\n\t\t\treturn OboeStream.search(params);\r\n\t\t};\r\n\t}\r\n])\r\n\r\n.factory('OboeStream', ['$q', function($q) {\r\n\treturn {\r\n\r\n\t\tsearch: function(params) {\r\n\r\n\t\t\tvar defer = $q.defer(),\r\n\t\t\t\tcounter = 0,\r\n\t\t\t\tpagesize = params.pagesize || 100,\r\n\t\t\t\tpage = [];\r\n\r\n\t\t\toboe(params).start(function() {\r\n\t\t\t\t// do nothing or notify starting of download\r\n\t\t\t}).node(params.pattern, function(node) {\r\n\t\t\t\tdefer.notify(node);\r\n\t\t\t\toboe.drop;\r\n\t\t\t}).done(function(result) {\r\n\t\t\t\tdefer.resolve(result);\r\n\t\t\t});\r\n\t\t\treturn defer.promise;\r\n\t\t}\r\n\t};\r\n}]);\r\n```\r\n\r\nThe usage would be like this:\r\n```\r\n$scope.data = [];\r\nOboe({\r\n  url: url,\r\n  pattern: '*'\r\n}).then(function(lastChunk){\r\n  $scope.data.push(lastChunk);\r\n}, function(reason){\r\n  // some error occured\r\n}, function(update){\r\n  $scope.data.push(update);\r\n});\r\n```\r\n\r\nWhat do you think?"},"comment":{"url":"https://api.github.com/repos/RonB/angular-oboe/issues/comments/82600082","html_url":"https://github.com/RonB/angular-oboe/issues/3#issuecomment-82600082","issue_url":"https://api.github.com/repos/RonB/angular-oboe/issues/3","id":82600082,"user":{"login":"RonB","id":559779,"avatar_url":"https://avatars.githubusercontent.com/u/559779?v=3","gravatar_id":"","url":"https://api.github.com/users/RonB","html_url":"https://github.com/RonB","followers_url":"https://api.github.com/users/RonB/followers","following_url":"https://api.github.com/users/RonB/following{/other_user}","gists_url":"https://api.github.com/users/RonB/gists{/gist_id}","starred_url":"https://api.github.com/users/RonB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RonB/subscriptions","organizations_url":"https://api.github.com/users/RonB/orgs","repos_url":"https://api.github.com/users/RonB/repos","events_url":"https://api.github.com/users/RonB/events{/privacy}","received_events_url":"https://api.github.com/users/RonB/received_events","type":"User","site_admin":false},"created_at":"2015-03-17T21:04:05Z","updated_at":"2015-03-17T21:04:05Z","body":"Agree. Sorry for this! Has been fixed."}}