https://github.com/morglod/plankee
world smallest event emitter
https://github.com/morglod/plankee
eventemitter events javascript minimal smallest tiny
Last synced: about 1 month ago
JSON representation
world smallest event emitter
- Host: GitHub
- URL: https://github.com/morglod/plankee
- Owner: Morglod
- Created: 2024-05-21T12:12:07.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T17:01:43.000Z (about 2 years ago)
- Last Synced: 2025-02-25T02:17:21.119Z (over 1 year ago)
- Topics: eventemitter, events, javascript, minimal, smallest, tiny
- Language: TypeScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# plank event emitter
Smallest was [nanoevents](https://github.com/ai/nanoevents) but it is 219 minified size and 138 brotlied **(not 107!!!)**
So why we should waste so much memory in JS?
Real original size 93 bytes
Real broitled size **81 bytes**
Broitled size inside app **77 bytes**
Usage:
```
npm i plankee
```
```ts
import { pee } from "plankee";
const [onLog, emitLog] = pee<[text: string]>();
const removeListener = onLog((text) => console.log("log: " + text));
emitLog("hello world!");
removeListener();
```
## API
```ts
[subscribe, emit] = pee<[ARGUMENTS]>();
// subscribe returns disposer
```