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> {
|
function imageLoaded(img: HTMLImageElement): Promise<void> {
|
||||||
if (img.complete) {
|
return img.complete
|
||||||
return;
|
? Promise.resolve()
|
||||||
}
|
: new Promise((resolve) => {
|
||||||
return new Promise((resolve) => {
|
img.addEventListener("load", () => resolve());
|
||||||
img.addEventListener("load", () => resolve());
|
img.addEventListener("error", () => resolve());
|
||||||
img.addEventListener("error", () => resolve());
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollToAnswer(): void {
|
function scrollToAnswer(): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user