# @blackglory/wait-for

> A module for waiting for things to happen.

Latest version **0.8.5** (published 2026-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @blackglory/wait-for
pnpm add @blackglory/wait-for
yarn add @blackglory/wait-for
bun add @blackglory/wait-for
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.8.5 |
| Published | 2026-02-20 |
| First published | 2020-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 6 |
| Unpacked size | 41 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |
| Keywords | waitFor, DOM |

## Links

- npm: https://www.npmjs.com/package/@blackglory/wait-for
- Repository: https://github.com/BlackGlory/wait-for
- Homepage: https://github.com/BlackGlory/wait-for#readme
- Issues: https://github.com/BlackGlory/wait-for/issues
- npm.io page: https://npm.io/package/@blackglory/wait-for

## Dependencies (6)

- [rxjs](https://npm.io/package/rxjs.md) ^7.8.2
- [extra-timers](https://npm.io/package/extra-timers.md) ^0.3.0
- [extra-promise](https://npm.io/package/extra-promise.md) ^7.0.1
- [iterable-operator](https://npm.io/package/iterable-operator.md) ^5.1.0
- [@blackglory/observe](https://npm.io/package/@blackglory/observe.md) ^0.3.0
- [@blackglory/structures](https://npm.io/package/@blackglory/structures.md) ^0.14.11

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.8.5 (latest) — 2026-02-20
- 0.8.4 — 2025-11-30
- 0.8.3 — 2025-11-26
- 0.8.2 — 2025-10-31
- 0.8.1 — 2025-02-14
- 0.8.0 — 2025-01-20
- 0.7.4 — 2023-06-11
- 0.7.3 — 2023-03-18
- 0.7.2 — 2023-03-18
- 0.7.1 — 2023-03-10
- 0.7.0 — 2023-03-08
- 0.5.4 — 2023-01-28
- 0.6.0 — 2022-11-19
- 0.5.3 — 2022-11-01
- 0.5.2 — 2022-11-01
- … 32 more at https://npm.io/package/@blackglory/wait-for/versions

## README

# wait-for
A module for waiting for things to happen.

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

## API
### waitForDOMChanged
```ts
function waitForDOMChanged(): Promies<void>
```

### waitForAttached
```ts
function waitForAttached(...nodes: Node[]): Promise<void>
```

### waitForDetached
```ts
function waitForDetached(...nodes: Node[]): Promise<void>
```

### waitForElementsMatchingSelectorAttached
```ts
function waitForElementsMatchingSelectorAttached(
  selector: string
): Promise<Element[]>
```

### waitForAllElementsMatchingSelectorDetached
```ts
function waitForAllElementsMatchingSelectorDetached(
  selector: string
): Promise<void>
```

### waitForEventTarget
```ts
function waitForEventTarget<T extends EventTarget>(
  target: T
, event: string
, signal?: AbortSignal
): Promise<Event>
```

### waitForEventEmitter
```ts
function waitForEventEmitter<T extends EventEmitter>(
  target: T
, event: string
, signal?: AbortSignal
): Promise<unknown[]>
```

### waitForEmitter
```ts
function waitForEmitter<
  EventToArgs extends Record<string, unknown[]>
, Event extends keyof EventToArgs
>(
  target: Emitter<EventToArgs>
, event: Event
, signal?: AbortSignal
): Promise<EventToArgs[Event]>
```

### waitForDOMContentLoaded
```ts
function waitForDOMContentLoaded(): Promise<void>
```

### waitForLoad
```ts
function waitForLoad(): Promise<void>
```

### waitForComplete
```ts
function waitForComplete(): Promise<void>
```

### waitForInteractiveOrComplete
```ts
function waitForInteractiveOrComplete(): Promise<void>
```

### waitForFunction
```ts
function waitForFunction<T>(
  fn: () => T | PromiseLike<T>
, interval: number = 0
): Promise<T>
```

### waitForTimeout
```ts
function waitForTimeout(ms: number, signal?: AbortSignal): Promise<void>
```

### waitForSchedule
```ts
function waitForSchedule(timestamp: number, signal?: AbortSignal): Promise<void>
```

### waitForStateChanged
```ts
function waitForStateChanged(): Promise<void>
```

### waitForUrlChanged
```ts
function waitForUrlChanged(): Promise<void>
```

### waitForAllMacrotasksProcessed
```ts
function waitForAllMacrotasksProcessed(): Promise<void>
```

### waitForAllMicrotasksProcessed
```ts
function waitForAllMicrotasksProcessed(): Promise<void>
```

### waitForIdleCallback
```ts
function waitForIdleCallback(options?: IdleRequestOptions): Promise<IdleDeadline>
```

### waitForAnimationFrame
```ts
function waitForAnimationFrame(): Promise<DOMHighResTimeStamp>
```

### waitForVideoFrameCallback
```ts
function waitForVideoFrameCallback(
  video: HTMLVideoElement
): Promise<Parameters<VideoFrameRequestCallback>>
```

---
_Source: https://npm.io/package/@blackglory/wait-for · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
