# evtd

> Event delegation with native events and extended events.

Latest version **0.2.4** (published 2022-08-07) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2022-08-07 |
| First published | 2020-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 07akioni |
| Maintainers | 07akioni |

## Links

- npm: https://www.npmjs.com/package/evtd
- npm.io page: https://npm.io/package/evtd

## Recent versions

- 0.2.4 (latest) — 2022-08-07
- 0.2.4-beta.0 (beta) — 2022-07-31
- 0.2.3 — 2021-11-14
- 0.2.2 — 2021-06-02
- 0.2.1 — 2021-06-02
- 0.2.0 — 2021-04-05
- 0.1.1 — 2021-02-24
- 0.1.0 — 2020-11-27
- 0.0.1-alpha.5 — 2020-11-26
- 0.0.1-alpha.4 — 2020-11-26
- 0.0.1-alpha.3 — 2020-11-11
- 0.0.1-alpha.2 — 2020-11-05
- 0.0.1-alpha.1 — 2020-11-04
- 0.0.1-alpha.0 — 2020-11-04

## README

# evtd
Event delegation with native events and extended events in a small library.

(Only 300 lines of codes)
## Docs
[evtd](https://evtd.vercel.app/)

## Basic Usage
```ts
import { on, off } from 'evtd'

function handleClick () {
  console.log('click')
}

// register event
on(window, 'click', handleClick)
on(document, 'click', handleClick)
on(eventTarget, 'click', handleClick)

// evtd has 2 extended events
on(eventTarget, 'clickoutside', handleClick)
on(eventTarget, 'mousemoveoutside', handleClick)

// unregister
const handleClick2 = () => console.log('click2')
on(eventTarget, 'click', handleClick2)
off(eventTarget, 'click', handleClick2)

// capture
on(eventTarget, 'click', handleClick2, true)
off(eventTarget, 'click', handleClick2, true)
```

## License
MIT

Inspired by [delegated-events](https://github.com/dgraham/delegated-events)

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