Re: [whatwg/fetch] Proposal: fetch with multiple AbortSignals (#905)

fwiw

```js
function anySignal(...signals) {
  const controller = new AbortController();

  function onAbort() {
    controller.abort();

    // Cleanup
    for (const signal of signals) {
      signal.removeEventListener('abort', onAbort);
    }
  }

  for (const signal of signals) {
    if (signal.aborted) {
      onAbort();
      return;
    }
    signal.addEventListener('abort', onAbort);
  }
  
  return controller.signal;
}
```

-- 
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/fetch/issues/905#issuecomment-491970649

Received on Monday, 13 May 2019 20:19:16 UTC