{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/fetch/issues/27","repository_url":"https://api.github.com/repos/whatwg/fetch","labels_url":"https://api.github.com/repos/whatwg/fetch/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/fetch/issues/27/comments","events_url":"https://api.github.com/repos/whatwg/fetch/issues/27/events","html_url":"https://github.com/whatwg/fetch/issues/27","id":64476705,"number":27,"title":"Aborting a fetch","user":{"login":"annevk","id":1544111,"avatar_url":"https://avatars.githubusercontent.com/u/1544111?v=3","gravatar_id":"","url":"https://api.github.com/users/annevk","html_url":"https://github.com/annevk","followers_url":"https://api.github.com/users/annevk/followers","following_url":"https://api.github.com/users/annevk/following{/other_user}","gists_url":"https://api.github.com/users/annevk/gists{/gist_id}","starred_url":"https://api.github.com/users/annevk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/annevk/subscriptions","organizations_url":"https://api.github.com/users/annevk/orgs","repos_url":"https://api.github.com/users/annevk/repos","events_url":"https://api.github.com/users/annevk/events{/privacy}","received_events_url":"https://api.github.com/users/annevk/received_events","type":"User","site_admin":false},"labels":[{"id":308176090,"url":"https://api.github.com/repos/whatwg/fetch/labels/addition","name":"addition","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":{"login":"jakearchibald","id":93594,"avatar_url":"https://avatars.githubusercontent.com/u/93594?v=3","gravatar_id":"","url":"https://api.github.com/users/jakearchibald","html_url":"https://github.com/jakearchibald","followers_url":"https://api.github.com/users/jakearchibald/followers","following_url":"https://api.github.com/users/jakearchibald/following{/other_user}","gists_url":"https://api.github.com/users/jakearchibald/gists{/gist_id}","starred_url":"https://api.github.com/users/jakearchibald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakearchibald/subscriptions","organizations_url":"https://api.github.com/users/jakearchibald/orgs","repos_url":"https://api.github.com/users/jakearchibald/repos","events_url":"https://api.github.com/users/jakearchibald/events{/privacy}","received_events_url":"https://api.github.com/users/jakearchibald/received_events","type":"User","site_admin":false},"assignees":[{"login":"jakearchibald","id":93594,"avatar_url":"https://avatars.githubusercontent.com/u/93594?v=3","gravatar_id":"","url":"https://api.github.com/users/jakearchibald","html_url":"https://github.com/jakearchibald","followers_url":"https://api.github.com/users/jakearchibald/followers","following_url":"https://api.github.com/users/jakearchibald/following{/other_user}","gists_url":"https://api.github.com/users/jakearchibald/gists{/gist_id}","starred_url":"https://api.github.com/users/jakearchibald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakearchibald/subscriptions","organizations_url":"https://api.github.com/users/jakearchibald/orgs","repos_url":"https://api.github.com/users/jakearchibald/repos","events_url":"https://api.github.com/users/jakearchibald/events{/privacy}","received_events_url":"https://api.github.com/users/jakearchibald/received_events","type":"User","site_admin":false}],"milestone":null,"comments":312,"created_at":"2015-03-26T09:08:23Z","updated_at":"2016-11-03T14:33:18Z","closed_at":null,"body":"## Goal\n\nProvide developers with a method to abort something initiated with `fetch()` in a way that is not overly complicated.\n## Previous discussion\n- https://github.com/whatwg/fetch/issues/20\n- https://github.com/slightlyoff/ServiceWorker/issues/592\n- https://github.com/slightlyoff/ServiceWorker/issues/625\n- https://github.com/whatwg/streams/issues/297\n- https://github.com/domenic/cancelable-promise/issues/4 (security issues)\n## Viable solutions\n\nWe have two contenders. Either `fetch()` returns an object that is more than a promise going forward or `fetch()` is passed something, either an object or a callback that gets handed an object.\n### A promise-subclass\n\nIn order to not clash with cancelable promises (if they ever materialize) we should pick a somewhat unique method name for abortion. I think `terminate()` would fit that bill.\n\n```\nvar f = fetch(url)\nf.terminate()\n```\n\nNote: the Twitter-sphere seemed somewhat confused about the capabilities of this method. It would most certainly terminate any ongoing stream activity as well. It's not limited to the \"lifetime\" of the promise.\n### A controller\n\nThe limited discussion on es-discuss https://esdiscuss.org/topic/cancelable-promises seemed to favor a controller. There are two flavors that keep coming back. Upfront construction:\n\n```\nvar c = new FetchController\nfetch(url, {controller: c})\nc.abort()\n```\n\nRevealing constructor pattern:\n\n```\nfetch(url, {controller: c => c.abort()})\n```\n## Open issues\n- What is the effect on the promise? Both forever-pending and explicit rejection have reasonable arguments. We could offer the choice to the developer, but what should be the default?\n- What is the effect on the stream? I suspect the Streams Standard is already conclusive on this.\n- What syntax of the above two-three solutions do we favor?\n"},"comment":{"url":"https://api.github.com/repos/whatwg/fetch/issues/comments/258159173","html_url":"https://github.com/whatwg/fetch/issues/27#issuecomment-258159173","issue_url":"https://api.github.com/repos/whatwg/fetch/issues/27","id":258159173,"user":{"login":"Noiwex","id":1125405,"avatar_url":"https://avatars.githubusercontent.com/u/1125405?v=3","gravatar_id":"","url":"https://api.github.com/users/Noiwex","html_url":"https://github.com/Noiwex","followers_url":"https://api.github.com/users/Noiwex/followers","following_url":"https://api.github.com/users/Noiwex/following{/other_user}","gists_url":"https://api.github.com/users/Noiwex/gists{/gist_id}","starred_url":"https://api.github.com/users/Noiwex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Noiwex/subscriptions","organizations_url":"https://api.github.com/users/Noiwex/orgs","repos_url":"https://api.github.com/users/Noiwex/repos","events_url":"https://api.github.com/users/Noiwex/events{/privacy}","received_events_url":"https://api.github.com/users/Noiwex/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T14:33:18Z","updated_at":"2016-11-03T14:33:18Z","body":"It's just shows that fetch specification is really underdone."}}
{"actor":{"display_login":"Noiwex"}}