# event-target-polyfill

> An EventTarget Polyfill

Latest version **0.0.4** (published 2023-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install event-target-polyfill
pnpm add event-target-polyfill
yarn add event-target-polyfill
bun add event-target-polyfill
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-11-06 |
| First published | 2020-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Ben Lesh |
| Maintainers | blesh |
| Keywords | EventTarget, Polyfill |

## Links

- npm: https://www.npmjs.com/package/event-target-polyfill
- Repository: https://github.com/benlesh/event-target-polyfill
- Homepage: https://github.com/benlesh/event-target-polyfill#readme
- Issues: https://github.com/benlesh/event-target-polyfill/issues
- npm.io page: https://npm.io/package/event-target-polyfill

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2023-11-06
- 0.0.3 — 2021-03-28
- 0.0.2 — 2020-07-15
- 0.0.1 — 2020-07-14

## README

[![npm version](https://badge.fury.io/js/event-target-polyfill.svg)](https://badge.fury.io/js/event-target-polyfill)
![Node.js CI](https://github.com/benlesh/event-target-polyfill/workflows/Node.js%20CI/badge.svg)

# event-target-polyfill

A polyfill for `EventTarget` (and `Event`), meant to run in older version of node or possibly IE 11, that has the most accurate set of characteristics of `EventTarget` that can be provided.

If you find this implementation can be improved, please submit a PR and ping me [on Twitter via DM](https://twitter.com/benlesh).

**NOTE: If you are using Node 14 and higher, [EventTarget is available directly](https://nodejs.org/api/events.html#events_eventtarget_and_event_api) via experimental features**
MDN: [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)

## Usage

```
import 'event-target-polyfill';

const et = new EventTarget();

et.addEventListener('test', () => console.log('hit!'));

et.dispatchEvent(new Event('test'));
```

## Development

This library has no dependencies. Even development dependencies. To test just run `npm test`. It runs a script, and if it finishes without error, the tests pass.

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