Make imageLoaded adhere to its function signature
This commit is contained in:
parent
f4f0298378
commit
74a9d0b0a1
@ -162,13 +162,12 @@ function allImagesLoaded(): Promise<void[]> {
|
||||
}
|
||||
|
||||
function imageLoaded(img: HTMLImageElement): Promise<void> {
|
||||
if (img.complete) {
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
img.addEventListener("load", () => resolve());
|
||||
img.addEventListener("error", () => resolve());
|
||||
});
|
||||
return img.complete
|
||||
? Promise.resolve()
|
||||
: new Promise((resolve) => {
|
||||
img.addEventListener("load", () => resolve());
|
||||
img.addEventListener("error", () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
function scrollToAnswer(): void {
|
||||
|
Loading…
Reference in New Issue
Block a user