Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions docs/concepts/promises.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,7 @@ function loadImageCallback(url, onSuccess, onError) {
// Promise-based wrapper
function loadImage(url) {
return new Promise((resolve, reject) => {
const img = new Image()
img.onload = () => resolve(img)
img.onerror = () => reject(new Error(`Failed to load ${url}`))
img.src = url
loadImageCallback(url, resolve, reject);
})
}

Expand Down