Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for AbortSignal to cancel requests (#539)
Thx @jnields @FrogTheFrog @TimothyGu for their work!
- Loading branch information
Showing
9 changed files
with
469 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* abort-error.js | ||
* | ||
* AbortError interface for cancelled requests | ||
*/ | ||
|
||
/** | ||
* Create AbortError instance | ||
* | ||
* @param String message Error message for human | ||
* @return AbortError | ||
*/ | ||
export default function AbortError(message) { | ||
Error.call(this, message); | ||
|
||
this.type = 'aborted'; | ||
this.message = message; | ||
|
||
// hide custom error implementation details from end-users | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
|
||
AbortError.prototype = Object.create(Error.prototype); | ||
AbortError.prototype.constructor = AbortError; | ||
AbortError.prototype.name = 'AbortError'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.