A module for waiting for things to happen.
npm install --save @blackglory/wait-for
# or
yarn add @blackglory/wait-forfunction waitForDOMChanged(): Promies<void>function waitForAttached(...nodes: Node[]): Promise<void>function waitForDetached(...nodes: Node[]): Promise<void>function waitForElementsMatchingSelectorAttached(
selector: string
): Promise<Element[]>function waitForAllElementsMatchingSelectorDetached(
selector: string
): Promise<void>function waitForEventTarget<T extends EventTarget>(
target: T
, event: string
, signal?: AbortSignal
): Promise<Event>function waitForEventEmitter<T extends EventEmitter>(
target: T
, event: string
, signal?: AbortSignal
): Promise<unknown[]>function waitForEmitter<
EventToArgs extends Record<string, unknown[]>
, Event extends keyof EventToArgs
>(
target: Emitter<EventToArgs>
, event: Event
, signal?: AbortSignal
): Promise<EventToArgs[Event]>function waitForDOMContentLoaded(): Promise<void>function waitForLoad(): Promise<void>function waitForComplete(): Promise<void>function waitForInteractiveOrComplete(): Promise<void>function waitForFunction<T>(
fn: () => T | PromiseLike<T>
, interval: number = 0
): Promise<T>function waitForTimeout(ms: number, signal?: AbortSignal): Promise<void>function waitForSchedule(timestamp: number, signal?: AbortSignal): Promise<void>function waitForStateChanged(): Promise<void>function waitForUrlChanged(): Promise<void>function waitForAllMacrotasksProcessed(): Promise<void>function waitForAllMicrotasksProcessed(): Promise<void>function waitForIdleCallback(options?: IdleRequestOptions): Promise<IdleDeadline>function waitForAnimationFrame(): Promise<DOMHighResTimeStamp>function waitForVideoFrameCallback(
video: HTMLVideoElement
): Promise<Parameters<VideoFrameRequestCallback>>