Skip to content

Commit ebec172

Browse files
committed
Add support for AbortController (developit#54)
1 parent 5556015 commit ebec172

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export default typeof fetch=='function' ? fetch.bind() : function(url, options)
1515
resolve(response());
1616
};
1717

18+
if (options.signal) options.signal.onabort = () => request.abort();
19+
20+
request.onabort = reject;
21+
1822
request.onerror = reject;
1923

2024
request.send(options.body);

0 commit comments

Comments
 (0)