Re: [whatwg/fetch] Add timeout option (#20)

Using the abort syntax, you'll be able to do:

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

const fetchPromise = fetch(url, {signal});

// 5 second timeout:
const timeoutId = setTimeout(() => controller.abort(), 5000);
const response = await fetchPromise;
// …
```

If you only wanted to timeout the request, not the response, add:

```js
clearTimeout(timeoutId);
// …
```

-- 
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/20#issuecomment-323740783

Received on Monday, 21 August 2017 13:11:31 UTC