Fix decode() promise wording: clarify one promise per call#43326
Fix decode() promise wording: clarify one promise per call#43326hamishwillee merged 2 commits intomdn:mainfrom
Conversation
|
Hi, @hamishwillee @Josh-Cena |
|
@dataCenter430 Thanks! Please see this text in https://developer.mozilla.org/en-US/docs/MDN/Community/Issues#general_triaging_tasks
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. |
|
Preview URLs (1 page) (comment last updated: 2026-03-06 00:01:49) |
|
Hi, @hamishwillee |
hamishwillee
left a comment
There was a problem hiding this comment.
Thanks very much @dataCenter430 - and welcome to MDN
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
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)