firebase / firebase/firebase-js-sdk
FR: add the ability to pass abort signal to httpsCallable
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### Describe your environment
* Operating System version: macOs Catalina 10.15.4
* Browser version: Google Chrome 81.0.4044.129
* Firebase SDK version: 7.14.3
* Firebase Product: functions
### Describe the problem
It's impossible to cancel the `httpsCallable` call in response to some user event e.g. button click.
The proposed solution is to pass down the abort signal to the `fetch` invocation as described in [MDN AbortSignal docs](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). The `signal` parameter could be a part of `HttpsCallableOptions`.
#### Relevant Code:
```javascript
interface HttpsCallableOptions {
timeout?: number;
signal?: AbortSignal;
}
const controller = new AbortController();
const abortSignal = controller.signal;
functions.httpsCallable('myFirebaseFunction', {
signal: abortSignal
});
```
Contributor guide
Assessment
This issue has not been assessed yet.