# delegate-events

> Event delegation component

Latest version **1.1.1** (published 2015-05-13) · 0 weekly downloads

## Install

```sh
npm install delegate-events
pnpm add delegate-events
yarn add delegate-events
bun add delegate-events
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2015-05-13 |
| First published | 2014-02-24 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | henrikjoreteg |
| Keywords | delegate, delegation, event, events |

## Links

- npm: https://www.npmjs.com/package/delegate-events
- Repository: https://github.com/HenrikJoreteg/delegate
- Issues: https://github.com/HenrikJoreteg/delegate/issues
- npm.io page: https://npm.io/package/delegate-events

## Dependencies (2)

- [closest](https://npm.io/package/closest.md) *
- [component-event](https://npm.io/package/component-event.md) *

## 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

- 1.1.1 (latest) — 2015-05-13
- 1.1.0 — 2014-04-08
- 1.0.0 — 2014-02-24

## README

# delegate

  Low-level event delegation component. Forked from component/delegate for use with browserify.

## Installation

    $ npm install delegate-events

## Example

```js
var delegate = require('delegate-events');
var ul = document.querySelector('ul');
var n = 0;

var fn = delegate.bind(ul, 'li a', 'click', function(e){
  console.log(e.target);
  console.log(e.delegateTarget); // => "<a>"
  if (++n == 3) {
    console.log('unbind');
    delegate.unbind(ul, 'click', fn, false);
  }
}, false);
```

## API

### .bind(el, selector, type, callback, [capture])

  Bind and return a callback which may be passed to `.unbind()`.

### .unbind(el, type, callback, [capture])

  Unbind.

## Tests

* Run `npm test`.
* Open `test/index.html` in a browser.
* Open the js console and verify that interacting with the elements works as they say they should.

## License

  MIT

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