-
Notifications
You must be signed in to change notification settings - Fork 72
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 `signal` AbortSignal in mappersmith request * Add node integration test for abortSignal * Implement support for abort signal in Gateways * Implement support for abort signal in XHR Gateway * Add changeset * Update README * Link to MDN docs * Update changelog * Add tests showing the request params might be undefined
- Loading branch information
Showing
13 changed files
with
400 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
'mappersmith': minor | ||
--- | ||
|
||
# Add support for abort signals | ||
|
||
The [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object. All gateway APIs (Fetch, HTTP and XHR) support this interface via the `signal` parameter: | ||
|
||
```javascript | ||
const abortController = new AbortController() | ||
// Start a long running task... | ||
client.Bitcoin.mine({ signal: abortController.signal }) | ||
// This takes too long, abort! | ||
abortController.abort() | ||
``` | ||
|
||
# Minor type fixes | ||
|
||
The return value of some functions on `Request` have been updated to highlight that they might return undefined: | ||
|
||
- `Request#body()` | ||
- `Request#auth()` | ||
- `Request#timeout()` | ||
|
||
The reasoning behind this change is that if you didn't pass them (and no middleware set them) they might simply be undefined. So the types were simply wrong before. If you experience a "breaking change" due to this change, then it means you have a potential bug that you didn't properly handle before. |
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
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.