# eventing

> A miniature event library

Latest version **0.1.0** (published 2018-08-19) · MIT license · 0 weekly downloads

## Install

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

## 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.1.0 |
| Published | 2018-08-19 |
| First published | 2018-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 32 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Andrew Musgrave |
| Maintainers | andrewmusgrave |

## Links

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

## Recent versions

- 0.1.0 (latest) — 2018-08-19

## README

# Eventing

A lightweight, minimal (~.650kb) JavaScript events library mimicking jquery. But Eventing well let you keep your blazing fast loading speeds.

## Installation

Use `npm` or `yarn`.

```
yarn add eventing
```

```
npm i -s eventing
```

Usage by CDN

```
unpkg.com/eventing@0.1.0/eventing.js
```

## Api

The core of `eventing` runs on a few main functions; `eventing`, `add`, `on`, `off`, `once`, and `trigger`.

#### Eventing

Used to created `eventing` objects.

```js
const buttons = eventing('button');
```

###### Type

`selector` - A selector used to query the document

```ts
eventing(selector: string): Eventing
```

#### Add

Used to add nodes to an `eventing` object.

```js
const buttons = eventing();
buttons.add('button');
```

###### Type

`selector` - A selector used to query the document

```ts
add(selector: string): Eventing
```

#### On / Once

Registers a single or multiple events.

```js
const buttons = eventing('button').on('click', () => console.log('clicked'));
const input = eventing('div').once('click focus', 'button', () =>
  console.log('clicked or focused'),
);
```

###### Type

`events` - A string of events to register
`delegatedTarget` - Optional selector for a delegated target
`handler` - Handler registered for the event or events

```ts
on(events: string, delegatedTarget?: string, handler: Function): Eventing
```

#### Off

Unregisters events

```js
buttons.off();
buttons.off('click');
buttons.off('click focus');
```

###### Type

`NO ARGS` - Unregisters all events associated with an eventing object
`events` - A string of events to unregister

```ts
off(events?: string): Eventing
```

#### Trigger

Triggers events

```js
eventing('button')
  .on('click', () => console.log('clicked'))
  .trigger('click');
```

###### Type

`events` - A string of events to unregister
`options` - Options used to created

```ts
trigger(events: string, options: Object): Eventing
```

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