Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,16 @@ const suites = {
new BenchmarkStep("DeletingAllItems", async () => {
const numberOfItemsPerIteration = 10;
const numberOfIterations = 10;
function iterationFinishedListener() {
iterationFinishedListener.promiseResolve();
}
window.addEventListener("previous-page-loaded", iterationFinishedListener);
const waitForPreviousPageLoaded = () => new Promise((resolve) => window.addEventListener("previous-page-loaded", resolve, { once: true }));
for (let j = 0; j < numberOfIterations; j++) {
const iterationFinishedPromise = new Promise((resolve) => {
iterationFinishedListener.promiseResolve = resolve;
});
const todoList = document.querySelector("todo-app").shadowRoot.querySelector("todo-list");
const items = todoList.shadowRoot.querySelectorAll("todo-item");
for (let i = numberOfItemsPerIteration - 1; i >= 0; i--) {
const item = items[i].shadowRoot.querySelector(".remove-todo-button");
item.click();
}
if (j < 9) {
const iterationFinishedPromise = waitForPreviousPageLoaded();
const previousPageButton = document.querySelector("todo-app").shadowRoot.querySelector("todo-bottombar").shadowRoot.querySelector(".previous-page-button");
previousPageButton.click();
await iterationFinishedPromise;
Expand Down
9 changes: 2 additions & 7 deletions experimental/javascript-wc-indexeddb/src/workload-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,16 @@ const suites = {
new BenchmarkStep("DeletingAllItems", async () => {
const numberOfItemsPerIteration = 10;
const numberOfIterations = 10;
function iterationFinishedListener() {
iterationFinishedListener.promiseResolve();
}
window.addEventListener("previous-page-loaded", iterationFinishedListener);
const waitForPreviousPageLoaded = () => new Promise((resolve) => window.addEventListener("previous-page-loaded", resolve, { once: true }));
for (let j = 0; j < numberOfIterations; j++) {
const iterationFinishedPromise = new Promise((resolve) => {
iterationFinishedListener.promiseResolve = resolve;
});
const todoList = document.querySelector("todo-app").shadowRoot.querySelector("todo-list");
const items = todoList.shadowRoot.querySelectorAll("todo-item");
for (let i = numberOfItemsPerIteration - 1; i >= 0; i--) {
const item = items[i].shadowRoot.querySelector(".remove-todo-button");
item.click();
}
if (j < 9) {
const iterationFinishedPromise = waitForPreviousPageLoaded();
const previousPageButton = document.querySelector("todo-app").shadowRoot.querySelector("todo-bottombar").shadowRoot.querySelector(".previous-page-button");
previousPageButton.click();
await iterationFinishedPromise;
Expand Down
Loading