- From: Anne van Kesteren <notifications@github.com>
- Date: Mon, 10 Apr 2017 00:22:50 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 10 April 2017 07:23:25 UTC
@rbuckton thanks, that's an interesting scenario. Let me try to sketch it out in terms of the API we have: ```js const controller = new AbortController, signal = controller.signal signal.onabort = abortion fetch("https://test:test/", { signal }).then(..., rejection) controller.abort() ``` The `fetch()` call directly rejects, with `rejection` being invoked at the end-of-task. `abortion` however is invoked directly after `controller.abort()`, before `rejection`. A solution to that would be to `.then()` the promise generated by the method to which _signal_ is passed and only once that rejects with an "AbortError", flip the state and dispatch the `abort` event. Over in https://github.com/whatwg/fetch/issues/447 folks wanted to be able to synchronously observe when `abort()` was invoked, though I suppose if that's actually a strong enough use case that could also be solved by the controller. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/434#issuecomment-292869591
Received on Monday, 10 April 2017 07:23:25 UTC