Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OWD project: Replace XMLHttpRequest in examples with fetch() #156

Closed
wbamberg opened this issue Jun 7, 2023 · 5 comments
Closed

OWD project: Replace XMLHttpRequest in examples with fetch() #156

wbamberg opened this issue Jun 7, 2023 · 5 comments
Assignees
Labels
H2 2023 Projects for July-December 2023 ready

Comments

@wbamberg
Copy link
Member

wbamberg commented Jun 7, 2023

Problem statement

Although we have for some time promoted fetch() and un-promoted XMLHttpRequest, we still have lots of examples that date from XMLHttpRequest times. We should if appropriate update them to use fetch().

Proposed solutions

No response

Task list

This would take an analysis phase, to figure out where we are using XHR and where we should replace it with fetch().

Priority assessment

  • Effort: Medium
  • Dependencies: No
  • Community enablement: Yes? (could get community help for this)
  • Momentum: No
  • Enabling learners: Yes
  • Enabling professionals: Yes
  • Underrepresented topics / Ethical web: No
  • Operational necessities: No
  • Addressing needs of the web industry: Yes

More information

No response

@Josh-Cena
Copy link

Josh-Cena commented Jun 27, 2023

See also: mdn/content#14157

@Elchi3 Elchi3 added the H2 2023 Projects for July-December 2023 label Jun 27, 2023
@Elchi3
Copy link
Member

Elchi3 commented Jun 27, 2023

This would take an analysis phase, to figure out where we are using XHR and where we should replace it with fetch().

@teoli2003 can you do the analysis and post it here? Once we have this, I can label this project "ready".

@Elchi3 Elchi3 changed the title Replace XMLHttpRequest in examples with fetch() OWD project: Replace XMLHttpRequest in examples with fetch() Jun 27, 2023
@Elchi3 Elchi3 mentioned this issue Jul 3, 2023
6 tasks
@yarusome
Copy link

yarusome commented Jul 6, 2023

A further suggestion: During this project, could await and try...catch be used in place of promise.then() and promise.catch()? The lengthy chains easily produced by the latter two make codes far less legible.

@Josh-Cena
Copy link

Josh-Cena commented Jul 6, 2023

@yarusome note though: our style guide recommends against top-level await, so for casual examples involving just one promise, then is the best approach. In general, we (that is, I) are not too keen to replace then with await unless it significantly simplifies nesting (not necessarily chaining).

@wbamberg
Copy link
Member Author

wbamberg commented Dec 20, 2023

I'm closing this as completed: mdn/imsc-examples#14 is still open but (1) it's not in content and (2) it's approved.

I haven't checked through mentions of XHR in Firefox/Releases, but apart from that all places we refer to XHR across MDN have been updated. This doesn't mean we don't mention XHR at all of course, it's still a legitimate part of the web platform. But we promote fetch() instead, and try to make it so people are aware of fetch() as the default tool to reach for when making HTTP requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
H2 2023 Projects for July-December 2023 ready
Projects
None yet
Development

No branches or pull requests

5 participants