# @whatwg-node/events

> Cross Platform Smart Event API Ponyfill

Latest version **0.1.2** (published 2024-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @whatwg-node/events
pnpm add @whatwg-node/events
yarn add @whatwg-node/events
bun add @whatwg-node/events
```

## Health

**Score 45/100 (D)** — status: abandoned.

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

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2024-07-29 |
| First published | 2022-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 1 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 198 |
| Author | Arda TANRIKULU |
| Maintainers | ardatan |

## Links

- npm: https://www.npmjs.com/package/@whatwg-node/events
- Repository: https://github.com/ardatan/whatwg-node
- Homepage: https://github.com/ardatan/whatwg-node#readme
- Issues: https://github.com/ardatan/whatwg-node/issues
- npm.io page: https://npm.io/package/@whatwg-node/events

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.6.3

## Recent versions

- 0.1.2 (latest) — 2024-07-29
- 0.2.0-alpha-20260921120829-953be1ba805992730bb868e06f5473882a24b2e8 (alpha) — 2026-09-21
- 0.1.2-rc-20240729093557-94eba750aa6126090cf8d833ab33eb8e70699369 (rc) — 2024-07-29
- 0.2.0-alpha-20260921021718-001449f594087288a290d3f89c5c539e7fd08b14 — 2026-09-21
- 0.2.0-alpha-20260921021525-a118397587d8a77d69241fd91dd9583c93c67bb9 — 2026-09-21
- 0.2.0-alpha-20260920172446-f1e89c18f42fa674a1b3816bbfb2d509d9556a31 — 2026-09-20
- 0.2.0-alpha-20260920154411-91f7e0a98820944bf532f100d544c24bdaba5d7f — 2026-09-20
- 0.2.0-alpha-20260920133717-acc4900d2807977fe674b49f1bfb0bd9724c467d — 2026-09-20
- 0.2.0-alpha-20260920131622-c315cda54f47b661ecb4a997755c04056e7f139f — 2026-09-20
- 0.2.0-alpha-20260920131133-a7d8b777d125de2d39ae5f7ded2a971fa5d6bd92 — 2026-09-20
- 0.2.0-alpha-20260920130935-a3b7e6bde7f92afef4648521daa55c6e4884fc79 — 2026-09-20
- 0.2.0-alpha-20260920130808-d1604a17012df82ab94f17c429a9ebc7de0c54d3 — 2026-09-20
- 0.2.0-alpha-20260920130000-c8eda2b6056ff2f3dcd32d462a4a666dec89ce8e — 2026-09-20
- 0.2.0-alpha-20260920125951-1dda28d9aa09a836ca5d8291611fe0a35954cfee — 2026-09-20
- 0.2.0-alpha-20260920125833-7ffa3001a4c4d63f8b292929e4d644e9401c294f — 2026-09-20
- … 161 more at https://npm.io/package/@whatwg-node/events/versions

## README

# `@whatwg-node/events`

A ponyfill package for JavaScript [DOM Events Standard](https://dom.spec.whatwg.org/#events). If
your JavaScript environment doesn't implement this standard natively, this package automatically
ponyfills the missing parts, and export them as a module.

## Installation

```bash
yarn add @whatwg-node/events
```

## Usage

```ts
import { Event, EventTarget } from '@whatwg-node/events'

const target = new EventTarget()
target.addEventListener('foo', (event: Event) => {
  console.log(event.type) // foo
})

target.dispatchEvent(new Event('foo'))
```

> If your environment already implements these natively, this package will export the native ones
> automatically.

## Custom Events

```ts
import { CustomEvent, EventTarget } from '@whatwg-node/events'

const target = new EventTarget()
target.addEventListener('foo', (event: CustomEvent) => {
  console.assert(event.detail.foo, 'bar')
})

// `detail` can take any value
target.dispatchEvent(new CustomEvent('foo', { detail: { foo: 'bar' } }))
```

## API

The following classes are exported by this package:

- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event)
- [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent)
- [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)

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