developit / developit/mitt

Mitt - some problems

Open
#164 1 comment 1 reaction 0 assignees View on GitHub
enhancement question
Dominant language
TypeScript
Stars
11.9k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

**I found some problems with mitt. Will these problems be considered in the future?**

```javascript
const emitter = mitt();
emitter.on("evt", () => {});
emitter.on("evt", () => { throw "some error." })
emitter.on("evt", () => { /** do something... */ })
```
while the
```javascript
emitter.emit("evt");
```
happen, there is no chance to run the third callback.

Also,

```javascript
emitter.on("evt", () => { emitter.off("evt") });
emitter.on("evt", () => { /** do something... */});
emitter.on("evt", () => { emitter.off("*") });
emitter.on("*", () => { /** do something... */});
emitter.on("*", () => { /** do something... */});
emitter.on("*", () => { /** do something... */});
```
while the
```javascript
emitter.emit("evt");
```
happen, there is no chance to run the "*" callback, but can run the second "evt" callback.

Also,

mitt not supports
```javascript
emitter.off(); // off all of the listeners.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.