# cvent

> An extension library based on browser events!

Latest version **0.0.5** (published 2020-04-10) · MIT license · 0 weekly downloads

## Install

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

## 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.0.5 |
| Published | 2020-04-10 |
| First published | 2020-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 70.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | littleLane |
| Maintainers | littlelane |
| Keywords | cvent, customeEvent, event, pubsub, eventEmitter |

## Links

- npm: https://www.npmjs.com/package/cvent
- Repository: https://github.com/littleLane/cvent
- Homepage: https://github.com/littleLane/cvent#readme
- Issues: https://github.com/littleLane/cvent/issues
- npm.io page: https://npm.io/package/cvent

## 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.5 (latest) — 2020-04-10
- 0.0.4 — 2020-04-08
- 0.0.3 — 2020-04-07
- 0.0.2 — 2020-04-05
- 0.0.1 — 2020-04-04

## README

# cvent

An extension library based on browser events!

## Installation

You can install the stable version by npm:

```bash
$ npm i cvent
// or
$ yarn add cvent
```

### Usage

Cvent provides flexible apis about event registration, unregistration, and trigger!

You can instantiate an object by

```javascript
import Cvent from 'cvent'

const cvent = new Cvent()
```

#### on

Register a single event

```javascript
const listener = (e) => {
  console.log(e)
}
cvent.on('click', listener)
```

Register multiple events

```javascript
const listener = (e) => {
  console.log(e)
}
cvent.on('click1, click2', listener)

// Same as above
cvent.on(['click1', 'click2'], listener)
```

#### off

Unregister a single event

```javascript
cvent.off('click', listener)
```

Unregister multiple events

```javascript
cvent.off(['click1', 'click2'], listener)
```

Unregister a kind of events

```javascript
cvent.off(['click1', 'click2'])
```

#### emit

Trigger a kind of events

```javascript
cvent.emit('click', [payload?: any])
```

#### emitDebounce

Trigger a kind of events by debounce!

```javascript
cvent.emit('click', [payload?: any], [debounceOptions])
```

DebounceOptions is an object!

#### emitThrottle

Trigger a kind of events by throttle!

```javascript
cvent.emit('click', [payload?: any], [throttleOptions])
```

ThrottleOptions is an object!

### Future Features

- [x] Only respond to the first trigger of the event
- [ ] Support the specified number of responses
- [x] Debounce supports last times will be called
- [ ] Keep improve...

### License

[MIT](https://github.com/reduxjs/redux/blob/master/LICENSE.md)

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