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

Document XMLHttpRequestUpload #25671

Merged
merged 24 commits into from Apr 4, 2023
Merged

Document XMLHttpRequestUpload #25671

merged 24 commits into from Apr 4, 2023

Conversation

teoli2003
Copy link
Member

Description

Document XMLHttpRequestUpload and its events

Motivation

openwebdocs/project#152

@github-actions github-actions bot added the Content:WebAPI Web API docs label Mar 27, 2023
Copy link
Contributor

@dawei-wang dawei-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing word

files/en-us/web/api/xmlhttprequestupload/index.md Outdated Show resolved Hide resolved
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:HTTP HTTP docs Content:JS JavaScript docs Content:Learn Learning area docs Content:Other Any docs not covered by another "Content:" label Content:WebExt WebExtensions docs labels Mar 30, 2023
@github-actions github-actions bot removed Content:WebExt WebExtensions docs Content:Learn Learning area docs Content:JS JavaScript docs Content:CSS Cascading Style Sheets docs Content:Other Any docs not covered by another "Content:" label Content:HTTP HTTP docs labels Mar 30, 2023
@teoli2003 teoli2003 marked this pull request as ready for review March 30, 2023 12:17
@teoli2003 teoli2003 requested a review from a team as a code owner March 30, 2023 12:17
@teoli2003 teoli2003 requested review from Elchi3 and removed request for a team March 30, 2023 12:17
@Elchi3
Copy link
Member

Elchi3 commented Mar 31, 2023

First impression: Looks great! Do we want to repeat the (rich) example on all sub pages, though?

@teoli2003
Copy link
Member Author

First impression: Looks great! Do we want to repeat the (rich) example on all sub pages, though?

I was unsure. i can keep only the js with some of the events?

@Elchi3
Copy link
Member

Elchi3 commented Mar 31, 2023

First impression: Looks great! Do we want to repeat the (rich) example on all sub pages, though?

I was unsure. i can keep only the js with some of the events?

I think we often put snippets. Maybe something like this for the loadend page:

Examples

Using the loadend event

You can use the loaded event hide the progress bar when an upload finished. For a complete code example that uploads a file, see the main XHR upload page.

xhr.upload.addEventListener("loadend", (event) => {
  progressBar.classList.remove("visible");
  if (event.loaded !== 0) {
    log.textContent = "Upload finished.";
  }
  abortButton.disabled = true;
});

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits. I think this looks good otherwise. It is mostly analog to XHR, I believe.

files/en-us/web/api/xmlhttprequestupload/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/xmlhttprequestupload/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/xmlhttprequestupload/index.md Outdated Show resolved Hide resolved
teoli2003 and others added 7 commits April 4, 2023 12:20
Co-authored-by: Florian Scholz <fs@florianscholz.com>
Co-authored-by: Florian Scholz <fs@florianscholz.com>
Co-authored-by: Florian Scholz <fs@florianscholz.com>
Co-authored-by: Florian Scholz <fs@florianscholz.com>
Co-authored-by: Florian Scholz <fs@florianscholz.com>
Co-authored-by: Florian Scholz <fs@florianscholz.com>
Co-authored-by: Florian Scholz <fs@florianscholz.com>
@Elchi3 Elchi3 merged commit 74cf7a1 into mdn:main Apr 4, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants