Revise Promise.all example#1477
Open
ksen0 wants to merge 2 commits into
Open
Conversation
7fb5987 to
ff60074
Compare
Updated the description to clarify the use of async/await and Promise.all for loading multiple images. Improved the explanation of loading images simultaneously and added a reference to loading fonts.
perminder-17
approved these changes
Jul 2, 2026
| --- | ||
|
|
||
| Use [`async/await`](https://beta.p5js.org/reference/p5/async_await/) keywords | ||
| together with [`Promise.all()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) to loading multiple images together. This can speed up sketch loading, because the images will be loaded at the same time, instead of one after the other. The images are drawn together on the canvas only after they all finish loading. |
Contributor
There was a problem hiding this comment.
Suggested change
| together with [`Promise.all()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) to loading multiple images together. This can speed up sketch loading, because the images will be loaded at the same time, instead of one after the other. The images are drawn together on the canvas only after they all finish loading. | |
| together with [`Promise.all()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) to load multiple images together. This can speed up sketch loading, because the images will be loaded at the same time, instead of one after the other. The images are drawn together on the canvas only after they all finish loading. |
xinemata
reviewed
Jul 2, 2026
xinemata
left a comment
There was a problem hiding this comment.
Overall this is an excellent update and feels more aligned with the rest of the examples.
| featuredImage: "../../../images/featured/16_Async_Await_PromiseAll-thumbnail.png" | ||
| featuredImageAlt: Three random images loaded and displayed on a canvas after using async/await and Promise.all. | ||
| title: Load Multiple Images with Promise.all | ||
| oneLineDescription: Load multiple resources, like images, at the same time with Promise.all. |
There was a problem hiding this comment.
The current one-liner can be less redundant, since Promise.all is already prominently featured in the title.
Possibly "Load multiple files at the same time before drawing on canvas."
"files" feel the least ambiguous to me, but I'm also okay with it being used interchangeably with "assets" or "resources".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This proposed revision:
Please note that this will break the existing link to this example but these links are not intended as permalinks. Search should be usable to find the correct resource (though right now there is a known problem with it)
Before:
After: