A module for waiting for things to happen.

Usage no npm install needed!

<script type="module">
  import blackgloryWaitFor from 'https://cdn.skypack.dev/@blackglory/wait-for';



A module for waiting for things to happen.


npm install --save @blackglory/wait-for
# or
yarn add @blackglory/wait-for


  • function 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): Promise<T>
  • function waitForEventEmitter<T extends EventEmitter>(target: T, event: string): Promise<T>
  • function waitForDOMContentLoaded (): Promise<void>
  • function waitForLoad(): Promise<void>
  • function waitForFunction<T>(fn: () => T | PromiseLike<T>): Promise<T>
  • function waitForTimeout(ms: number): Promise<void>
  • function waitForStateChanged(): Promise<void>
  • function waitForUrlChanged(): Promise<void>