# oi

> cross-browser domReady module

Latest version **0.9.5** (published 2013-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install oi
pnpm add oi
yarn add oi
bun add oi
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.5 |
| Published | 2013-10-31 |
| First published | 2012-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ryan Van Etten |
| Maintainers | ryanve |
| Keywords | domready, ready, events, ender, browser |

## Links

- npm: https://www.npmjs.com/package/oi
- Repository: https://github.com/ryanve/oi
- Issues: https://github.com/ryanve/oi/issues
- npm.io page: https://npm.io/package/oi

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.9.5 (latest) — 2013-10-31
- 0.9.3 — 2013-04-11
- 0.9.2 — 2013-04-11
- 0.9.1 — 2013-04-11
- 0.9.0 — 2012-09-13

## README

# [oi](../../)
#### cross-browser DOM ready module

```sh
$ npm install oi
```

### Usage

Fire a function when the DOM is ready:

```js
oi.domReady(function (oi) {
	// `this === document` in here
});
```

Simple cross-browser event methods:

```js
oi.addEvent(elem, eventName, handler);
oi.removeEvent(elem, eventName, handler);
```

### Integration

**oi** has a special method called `.bridge()` designed for integration. Integrated methods include the top-level `.domReady`/`.addEvent`/`.removeEvent` methods. If the `receiver` has an `.fn` object, it will also receive `.fn.ready`. Note that `oi.domReady` and `oi.fn.ready` are identical. The latter is provided purely for integration purposes.

```js
oi.bridge(receiver) // integrate `oi`'s public methods into `receiver` (won't overwrite existing props)
oi.bridge(receiver, true) // integrate `oi`'s public methods into `receiver` (overwrites existing props)
```

The default behavior of the `oi.bridge()` makes it so that the `receiver` becomes the first arg passed to fns, like so:

```js
receiver.domReady(function (receiver) {
	// `this === document` in here
});
```

jQuery-compatible receivers also get `.fn.ready`:

```js
receiver(document).ready(function (receiver) {
	// `this === document` in here
});
```

The `.domReady` (and `.fn.ready`) methods both contain both a `.remix()` method that can be used for freeform integration. Use this if you want to create a new version of the ready function which sends multiple custom args. The `.remix()` method returns a new version of itself:

```js
receiver.domReady = oi.domReady.remix(customArg0, customArg1 /*, ...*/);
```

See advanced [#integration notes in the source](oi.js).

## [MIT License](http://opensource.org/licenses/MIT)

Copyright (C) 2012 by [Ryan Van Etten](https://github.com/ryanve)

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