Switched firebase/database to use the `fetch()` api
Switched out the usage of XMLHttpRequest in @firebase/database for primitives from the more modern and better-supported Fetch API.
🦋 Changeset detected
Latest commit: b3cb3994fec2d27a684c84f2ee1b383c3c6e76b3
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 3 packages
| Name | Type |
|---|---|
| @firebase/database | Patch |
| @firebase/database-compat | Patch |
| firebase | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
I am a bit intrigued by this part "better-supported" What exactly does that mean, better supported by who/what?
Yeah I could've worded that better. Essentially - correct me if I'm wrong - but in modern cases, fetch is supported in all contexts where XMLHttpRequest is, plus a few additional ones. You can view the MDN docs for XMLHttpRequest and fetch for more information on availability.
Long story short: In addition, the fetch API is also supported on service workers and server-side environments such as Deno and NodeJS. Using the Fetch API potentially widens support, while also reducing code complexity.
By 'better supported', I simply mean there's slightly more environments where the Fetch API is officially adopted & supported.
Yeah I could've worded that better. Essentially - correct me if I'm wrong - but in modern cases, fetch is supported in all contexts where
XMLHttpRequestis, plus a few additional ones. You can view the MDN docs for XMLHttpRequest and fetch for more information on availability.Long story short: In addition, the fetch API is also supported on service workers and server-side environments such as Deno and NodeJS. Using the Fetch API potentially widens support, while also reducing code complexity.
By 'better supported', I simply mean there's slightly more environments where the Fetch API is officially adopted & supported.
gotcha, tnx for the explanation was just curious what it exactly meant in this context of the PR
Oh right yeah. As mentioned, fetch has slightly better support across platforms and an arguably more readable API. This PR intends to switch @firebase/database to use fetch instead, as it's more readable and has improved cross-platform support.