Tools for awaiting ready -- still can't make focus() work

This commit is contained in:
Ian Gulliver
2024-12-23 14:09:06 -08:00
parent 5e3d144d7a
commit 2082444b3b
14 changed files with 145 additions and 45 deletions

View File

@@ -1,3 +1,5 @@
import { waitForAnimationFrame } from "./event";
export class ElemWrapper {
public elem: HTMLElement;
@@ -51,4 +53,10 @@ export class ElemWrapper {
setID(id: string) {
this.elem.id = id;
}
}
async waitForShadowQuerySelector(selector: string) {
while (this.elem.shadowRoot?.querySelector(selector) === undefined) {
await waitForAnimationFrame();
}
}
}