Skip to content

Fix decode() promise wording: clarify one promise per call#43326

Merged
hamishwillee merged 2 commits intomdn:mainfrom
dataCenter430:fix/clarify-one-promise-per-call
Mar 6, 2026
Merged

Fix decode() promise wording: clarify one promise per call#43326
hamishwillee merged 2 commits intomdn:mainfrom
dataCenter430:fix/clarify-one-promise-per-call

Conversation

@dataCenter430
Copy link
Contributor

Description

Updates the ImageDecoder.decode() docs so the completeFramesOnly parameter is described in line with JavaScript promise semantics. The text now states that each call to decode() returns a new promise that settles once, and that further levels of detail are obtained by calling decode() again. Also fixes a typo in the progressive-decoding example comment and uses the correct variable name (imageDecoder) in the example.

Motivation

The previous wording (“the promise returned by decode() will resolve exactly once for each new level of detail”) suggested that a single promise could resolve multiple times, which contradicts how promises work in JavaScript. A promise settles only once (either fulfilled or rejected). The change clarifies that multiple resolutions correspond to multiple calls to decode(), each returning its own promise.

Additional details

Parameter description: Reworded so it’s explicit that “each call to decode() returns a new promise that resolves once” and that “call decode() again to receive further levels as they become available.”
Example: Comment typo “is won’t” → “won’t”; imageDecode → imageDecoder for consistency with the first example.

Related issues and pull requests

Fixes #43297 (Promise can't resolve multiple times)

@dataCenter430 dataCenter430 requested a review from a team as a code owner March 3, 2026 15:32
@dataCenter430 dataCenter430 requested review from hamishwillee and removed request for a team March 3, 2026 15:32
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Mar 3, 2026
@dataCenter430
Copy link
Contributor Author

dataCenter430 commented Mar 3, 2026

Hi, @hamishwillee @Josh-Cena
could you pls review the PR?
Best regards

@hamishwillee
Copy link
Collaborator

@dataCenter430 Thanks! Please see this text in https://developer.mozilla.org/en-US/docs/MDN/Community/Issues#general_triaging_tasks

If a pull request has been opened to fix the issue but has not been reviewed for a week, give the reviewer a gentle ping to ask if they can get to it.

It happens we're a small team with many priorities. We really appreciate the contributions and we'll get to them as soon as priorities allow. A nudge after a week is appreciate though, as longer might mean I missed something.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Preview URLs (1 page)

(comment last updated: 2026-03-06 00:01:49)

@dataCenter430
Copy link
Contributor Author

Hi, @hamishwillee
Thanks for your review.
I'm happy to contribute to content, 😄
Thanks again.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

Thanks very much @dataCenter430 - and welcome to MDN

@hamishwillee hamishwillee merged commit 21ece11 into mdn:main Mar 6, 2026
8 checks passed
jdatapple pushed a commit to jdatapple/content that referenced this pull request Mar 6, 2026
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promise can't resolve multiple times

2 participants