Re: [whatwg/dom] Abort controller design (#438)

this codes works right ?

```js
const controller = new AbortController()
const signal = controller.signal

Promise.race([
  fetch(url, {signal}),
  fetch(mirror1, {signal}), 
  fetch(mirror2, {signal}),
  fetch(mirror3, {signal}),
]).then((res) => {
  // first fetched response
  console.log(res)
  // stop rest of fetch
  // abort after resolve race(), so AbortErrors are unhandled
  controller.abort()
}).catch((err) => {
  if (err.name == 'AbortError') {
    // abort before race hasn't resolved
    return
  }
  // fail to race
  console.error(err)
})
```

-- 
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/issues/438#issuecomment-315999345

Received on Tuesday, 18 July 2017 08:47:44 UTC