# wait-for-any

> Wait until the condition is met. Used to detect dynamically injected variables, such as `window.ethereum`

Latest version **1.0.2** (published 2021-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install wait-for-any
pnpm add wait-for-any
yarn add wait-for-any
bun add wait-for-any
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-09-12 |
| First published | 2021-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | coffcer |

## Links

- npm: https://www.npmjs.com/package/wait-for-any
- Homepage: https://github.com/Coffcer/wait-for-any
- npm.io page: https://npm.io/package/wait-for-any

## Recent versions

- 1.0.2 (latest) — 2021-09-12
- 1.0.1 — 2021-09-10
- 1.0.0 — 2021-09-05

## README

# wait-for-any

Wait until the condition is met. Used to detect dynamically injected variables, such as `window.ethereum`

## Install

```
npm install wait-for-any
```

## Example

Wait until ethereum injection
``` js
import waitFor from 'wait-for-any'
const ethereum = await waitFor(() => window.ethereum)
console.log(ethereum === window.ethereum) // true
```

Browser
``` html
<script src="dist/index.js">
<script>
  window.waitFor()
</script>
```

## Parameter

`waitFor(condition, [options])`

* `condition`: function - if the return value is not null, the condition is true
* `options`
  * `timeout`: number - maximum detection time, default 5000 ms
  * `step`: number - interval between each detect, default 500 ms

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