Skip to content

Commit

Permalink
Add support for AbortController (developit#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbuerger committed Apr 17, 2018
1 parent 5556015 commit ebec172
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default typeof fetch=='function' ? fetch.bind() : function(url, options)
resolve(response());
};

if (options.signal) options.signal.onabort = () => request.abort();

request.onabort = reject;

request.onerror = reject;

request.send(options.body);
Expand Down

0 comments on commit ebec172

Please sign in to comment.