Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xantredev/make-emitted
https://github.com/xantredev/make-emitted
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/xantredev/make-emitted
- Owner: XantreDev
- Created: 2022-07-03T10:20:52.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T17:48:03.000Z (9 months ago)
- Last Synced: 2024-12-08T20:38:59.313Z (about 1 month ago)
- Language: TypeScript
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Small and simple event emitter
---
![Size](https://badgen.net/bundlephobia/minzip/[email protected])
![Dependecies count](https://badgen.net/bundlephobia/dependency-count/[email protected])
![Npm](https://badgen.net/npm/v/make-emitted)
---
**Uses ES6 Proxies**Works pretty easy
```js
import makeEmitted from 'make-emitted'const someObject = {
a: 5,
pow2: (a) => a ** 2
}const emitted = makeEmitted(someObject)
const id = emitted.on('pow2', () => console.log('pow2 method used'))
emitted.pow2() // pow2 method used
someObject.pow2() // Z-z-z
emitted.pow2() // pow2 method usedemitted.off(id)
emitted.pow2() // Z-z-z
```## Autocompletion by typescript
![Autocompletion](./imgs/autocompletion.png)