Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: fix image loading
Browse files Browse the repository at this point in the history
Fix #1
  • Loading branch information
gregberge committed Feb 18, 2023
1 parent 23dde98 commit bf0352b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -36,17 +36,8 @@ function waitForFontLoading() {
}

// Check if the images are loaded
async function waitForImagesLoading() {
return Promise.all(
Array.from(document.images)
.filter((img) => !img.complete)
.map(
(img) =>
new Promise((resolve) => {
img.onload = img.onerror = resolve;
})
)
);
function waitForImagesLoading() {
return Array.from(document.images).every((img) => img.complete);
}

type LocatorOptions = Parameters<Page["locator"]>[1];

0 comments on commit bf0352b

Please sign in to comment.